Sha256: cda63495a792bf9c14516d216e00c2da0996befc0512d00163ceb848bf6a342f

Contents?: true

Size: 529 Bytes

Versions: 2

Compression:

Stored size: 529 Bytes

Contents

module Canpe
  class TemplateBindingReflector
    attr_reader :call_list

    def initialize(call_list = [])
      @call_list = call_list
    end

    def method_missing(method, *args)
      Reflector.new(call_list + [{ method: method, args: args }])
    end

    def to_s
      method_chain = call_list.map do |hash|
        method_call = "#{hash[:method].to_s}"
        method_call += "(#{hash[:args].join(', ')})" if hash[:args].size > 0
        method_call
      end.join '.'
      "Error: #{method_chain}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
canpe-0.1.1 lib/canpe/template_binding_reflector.rb
canpe-0.1.0 lib/canpe/template_binding_reflector.rb