class Braingasm::PrefixStack
Attributes
stack[RW]
Public Class Methods
new()
click to toggle source
# File lib/braingasm/prefixes.rb, line 10 def initialize @stack = [] end
Public Instance Methods
fix_params(function, default_param=1)
click to toggle source
# File lib/braingasm/prefixes.rb, line 14 def fix_params(function, default_param=1) prefix = @stack.pop || default_param case prefix when Integer, String function.curry.call(prefix) when Proc proc do |m| n = prefix.call(m) function.call(n, m) end end end