class Mercury::Cps::SeqWithLet
Public Class Methods
new(parent_binding)
click to toggle source
# File lib/mercury/cps/seq_with_let.rb, line 41 def initialize(parent_binding) @__parent_binding = parent_binding end
Public Instance Methods
__chain()
click to toggle source
# File lib/mercury/cps/seq_with_let.rb, line 45 def __chain @__chain ||= Cps.identity end
__parent_call(name, *args, &block)
click to toggle source
# File lib/mercury/cps/seq_with_let.rb, line 53 def __parent_call(name, *args, &block) @__parent_caller ||= @__parent_binding.eval <<-EOD proc do |name, *args, &block| send(name, *args, &block) end EOD @__parent_caller.call(name, *args, &block) end
__values()
click to toggle source
# File lib/mercury/cps/seq_with_let.rb, line 62 def __values @__values ||= {} end
and_lift(&block)
click to toggle source
# File lib/mercury/cps/seq_with_let.rb, line 29 def and_lift(&block) @__chain = __chain.and_lift(&block) end
and_then(&block)
click to toggle source
# File lib/mercury/cps/seq_with_let.rb, line 25 def and_then(&block) @__chain = __chain.and_then(&block) end
let(name, &block)
click to toggle source
# File lib/mercury/cps/seq_with_let.rb, line 33 def let(name, &block) and_then(&block) and_then do |value| __values[name] = value Cps.lift{value} end end
method_missing(name, *args, &block)
click to toggle source
# File lib/mercury/cps/seq_with_let.rb, line 49 def method_missing(name, *args, &block) __values.fetch(name) { __parent_call(name.to_s, *args, &block) } end