module Rammed
Constants
- Core
Public Instance Methods
adjust(f, i, l)
click to toggle source
# File lib/rammed.rb, line 6 def adjust(f, i, l) new_list = l.clone new_list[i] = f.(l[i]) new_list.freeze end
curry_n(n, f)
click to toggle source
# File lib/rammed.rb, line 12 def curry_n(n, f) f.curry(n) end
invoker(n, sym, block=-1)
click to toggle source
# File lib/rammed.rb, line 16 def invoker(n, sym, block=-1) curry_n(n + 1, (lambda do |*args| block_removed_args = block >= 0 ? args.slice(0...block) + args.slice(block + 1..-1) : args actual_args = block_removed_args.slice(0...-1) obj = args.last block_arg = args[block] if block >= 0 if block_arg obj.send(sym, *(actual_args), &block_arg) else obj.send(sym, *(actual_args)) end end)) end