Class: Lab42::Core::Fn

Inherits:
BasicObject
Defined in:
lib/lab42/core/fn/basic_object.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &blk) ⇒ Object (private)



12
13
14
15
16
17
18
# File 'lib/lab42/core/fn/basic_object.rb', line 12

def method_missing *args, &blk
  return @source.method args.first if args.size == 1 && blk.nil?
  s = @source
  -> *a, &b do
    s.method( args.first ).(*(args[1..-1]+a), &(blk||b))
  end
end

Instance Method Details

#selfObject



4
5
6
# File 'lib/lab42/core/fn/basic_object.rb', line 4

def self;
  ->(*args,&blk){ @source } # This is *not* a recursive call
end