Class: Handlebars::Partials

Inherits:
Object
  • Object
show all
Defined in:
lib/handlebars/partials.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePartials

Returns a new instance of Partials.


5
6
7
# File 'lib/handlebars/partials.rb', line 5

def initialize
  @partials = {}
end

Instance Attribute Details

#partial_missingObject

Returns the value of attribute partial_missing


3
4
5
# File 'lib/handlebars/partials.rb', line 3

def partial_missing
  @partial_missing
end

Instance Method Details

#[](name) ⇒ Object


13
14
15
16
17
18
19
20
21
# File 'lib/handlebars/partials.rb', line 13

def [](name)
  if @partials.has_key?(name.to_s)
    return @partials[name.to_s]
  elsif @partial_missing
    return @partial_missing[name]
  else
    yield
  end
end

#[]=(name, value) ⇒ Object


9
10
11
# File 'lib/handlebars/partials.rb', line 9

def []=(name, value)
  @partials[name.to_s] = value
end