class Uberscore::Context

Public Class Methods

new() click to toggle source
# File lib/uberscore.rb, line 17
def initialize
  @call_chain = []
end

Public Instance Methods

method_missing(name, *args, &block) click to toggle source
# File lib/uberscore.rb, line 21
def method_missing(name, *args, &block)
  @call_chain << [name, args, block]
  self
end
to_proc() click to toggle source
# File lib/uberscore.rb, line 26
def to_proc
  ->(object) do
    @call_chain.reduce(object) do |block_parameter, (method_name, method_arguments, block)|
      block_parameter.public_send(method_name, *method_arguments, &block)
    end
  end
end