Class: FunctionObject::ArgumentsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/function_object/arguments_builder.rb

Defined Under Namespace

Classes: Descriptor

Instance Method Summary collapse

Instance Method Details

#argument(name, options = {}) ⇒ Object Also known as: arg



21
22
23
24
# File 'lib/function_object/arguments_builder.rb', line 21

def argument(name, options = {})
  default = options[:default]
  @descriptors << Descriptor.new(name, default, options)
end

#build(&block) ⇒ Object



15
16
17
18
19
# File 'lib/function_object/arguments_builder.rb', line 15

def build(&block)
  @descriptors = []
  instance_exec(&block)
  @descriptors
end