Module: Kernel
- Defined in:
- lib/lab419/core/kernel.rb
Instance Method Summary collapse
Instance Method Details
#applying(*args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/lab419/core/kernel.rb', line 4 def *args msg_or_lambda = args.shift case msg_or_lambda when String, Symbol ComposableProc.new do |*a| send( msg_or_lambda, *(args + a) ) end when Proc ComposableProc.new do |*a| msg_or_lambda.( *(args + a) ) end else raise ArgumentError, "need a message (str or sym) or a lambda to be applied to" end end |
#sendmsg(*args, &blk) ⇒ Object
20 21 22 23 24 |
# File 'lib/lab419/core/kernel.rb', line 20 def sendmsg *args, &blk ComposableProc.new do |receiver| receiver.send( *args, &blk ) end end |