Class: Canpe::TemplateBindingContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/canpe/template_binding_container.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ TemplateBindingContainer

Returns a new instance of TemplateBindingContainer.



7
8
9
# File 'lib/canpe/template_binding_container.rb', line 7

def initialize(hash)
  @hash = hash
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



5
6
7
# File 'lib/canpe/template_binding_container.rb', line 5

def hash
  @hash
end

Instance Method Details

#[](name) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/canpe/template_binding_container.rb', line 11

def [](name)
  if hash.key? name
    hash[name]
  else
    TemplateBindingReflector.new([{method: name, args: []}])
  end
end