class Object
Public Instance Methods
^(func, *others, &block)
click to toggle source
puts “hello”を “hello” ^ :putsで動かす
# File lib/pipe_chain.rb, line 53 def ^(func, *others, &block) if func.class == Symbol send(func, self) else # 普通の「^」を呼ぶ send(:__hat, func, *others, &block) if self.class.private_method_defined? :__hat end end
|(method, *others, &block)
click to toggle source
self.method が self | :methodで動くように
# File lib/pipe_chain.rb, line 40 def | (method, *others, &block) # method名がシンボルなら if method.class == Symbol self.send(method) elsif method.class == SymMethod self.send(method.name, *method.params, &method.block) else # method名がシンボルでないなら、普通の「|」を呼ぶ __bar(method, *others, &block) if self.class.private_method_defined? :__bar end end