class ConsMethod
Public Class Methods
new(f,g)
click to toggle source
# File lib/method_missing/cons_method.rb, line 4 def initialize(f,g) @f = f @g = g end
Public Instance Methods
*(h)
click to toggle source
# File lib/method_missing/cons_method.rb, line 9 def *(h) ConsMethod.new(self, h) end
/(h)
click to toggle source
# File lib/method_missing/cons_method.rb, line 13 def /(h) ApMethod.new([@f, @g, h]) end
[](*x)
click to toggle source
# File lib/method_missing/cons_method.rb, line 50 def [](*x) call(*x) end
^(n)
click to toggle source
# File lib/method_missing/cons_method.rb, line 17 def ^(n) if n < 2 self else ConsMethod.new(self, self ^ (n-1)) end end
arity()
click to toggle source
# File lib/method_missing/cons_method.rb, line 42 def arity @g.arity end
call(x)
click to toggle source
# File lib/method_missing/cons_method.rb, line 46 def call(x) @f.call(*@g.call(*x)) end
inspect()
click to toggle source
# File lib/method_missing/cons_method.rb, line 38 def inspect "#<ConsMethod: #{@f.inspect} * #{@g.inspect}>" end
owner()
click to toggle source
# File lib/method_missing/cons_method.rb, line 26 def owner @g.owner end
receiver()
click to toggle source
# File lib/method_missing/cons_method.rb, line 30 def receiver @g.receiver end
to_proc()
click to toggle source
# File lib/method_missing/cons_method.rb, line 34 def to_proc Proc.new {|x| @f.call(*@g.call(*x)) } end