Module: Kernel

Defined in:
lib/ruby_is.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



39
40
41
42
43
44
45
# File 'lib/ruby_is.rb', line 39

def method_missing(name, *args, &block)
  if (args.count == 1) and args.first.is_a?(Hash) and args.first.has_key?(:__is__method_body)
    define_method name, args.first[:__is__method_body]
  else
    super
  end
end

Instance Method Details

#is(*args, &block) ⇒ Object Also known as: are



33
34
35
# File 'lib/ruby_is.rb', line 33

def is(*args, &block);
  { __is__method_body: RubyIs.proc_or_block(args, block) }
end