Class: MethodObject::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/method_object/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, block, generator) ⇒ Base

Returns a new instance of Base.



20
21
22
23
24
25
26
# File 'lib/method_object/base.rb', line 20

def initialize(options, block, generator)
  options.each do |parameter_name, value|
    instance_variable_set("@#{parameter_name}", value)
  end
  return unless generator.block_parameter
  instance_variable_set("@#{generator.block_name}", block)
end

Class Method Details

.call(options = {}, &block) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/method_object/base.rb', line 5

def call(options = {}, &block)
  new(
    options,
    block,
    @generator)
  .call(*arguments_from_options(options), &block)
end