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



204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/dsl/ferrari.rb', line 204

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
  return ab
end