Class: Patme::ImplementationBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/patme/implementation_builder.rb

Overview

Parses method’s arguments and creates method implementation.

For example, if method looks like this:

def foo(arg1, arg2=‘foo’, _arg3=‘bar’)

# some code

end

then implementation will be created with the following arguments:

 arg1 - arbitrary argument
 arg2 - specific argument, 'foo'
_arg3 - optional argument, defaults to 'bar'

Instance Method Summary collapse

Constructor Details

#initialize(method_obj) ⇒ ImplementationBuilder

Returns a new instance of ImplementationBuilder.



16
17
18
# File 'lib/patme/implementation_builder.rb', line 16

def initialize(method_obj)
  @method_obj = method_obj
end

Instance Method Details

#buildObject



20
21
22
# File 'lib/patme/implementation_builder.rb', line 20

def build
  Patme::Implementation.new(@method_obj, arguments)
end