class GlueGun::ConfigBuilder::Commands::AfterMethod

Attributes

klass[R]
method_name[R]

Public Class Methods

new(builder, klass, method_name) click to toggle source
Calls superclass method GlueGun::ConfigBuilder::Command::new
# File lib/glue_gun/config_builder/commands/after_method.rb, line 8
def initialize(builder, klass, method_name)
  @klass = klass
  @method_name = method_name
  super(builder)
end

Public Instance Methods

call() click to toggle source
# File lib/glue_gun/config_builder/commands/after_method.rb, line 14
def call
  klass.module_exec(method_name, method_to_wrap, wrappers) { |name, method, procs|
    define_method(name) { |*args, &block|
      returing_value = method.bind(self).call(*args, &block)
      procs.each {|proc| proc.call(self) }
      returing_value
    }
  }
end

Private Instance Methods

method_to_wrap() click to toggle source
# File lib/glue_gun/config_builder/commands/after_method.rb, line 24
def method_to_wrap
  klass.instance_method(method_name)
end