Class | Proc |
In: |
lib/prelude.rb
|
Parent: | Object |
call | -> | ~ |
Syntaxic sugar for something like this: ~head(list), i.e., gives actual head instead of proc that can do it if called. |
This is will serve as an infix composition operator for procs. If between two procs, returns composition proc, executes left proc otherwise.
# File lib/prelude.rb, line 99 99: def **(*args) 100: if (1==args.length) && args[0].is_a?(Proc) 101: lambda {|*a| self.call(args[0].call(*a)) } 102: else 103: self.call(*args.flatten) 104: end 105: end