Class: Ruleby::Ferrari::MethodBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/dsl/ferrari.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_id, *args, &block) ⇒ Object



308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/dsl/ferrari.rb', line 308

def method_missing(method_id, *args, &block)
  ab = AtomBuilder.new method_id
  if block_given?
    args.each do |arg|   
      ab.bindings.push BindingBuilder.new(arg, method_id)
    end
    ab.block = block
  elsif args.size > 0
    puts args.class.to_s + ' --- ' + args.to_s
    raise 'Arguments not supported for short-hand conditions' 
  end
  ab
end