Class: Handlebars::Partials
- Inherits:
-
Object
- Object
- Handlebars::Partials
- Defined in:
- lib/handlebars/partials.rb
Instance Attribute Summary collapse
-
#partial_missing ⇒ Object
Returns the value of attribute partial_missing.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
-
#initialize ⇒ Partials
constructor
A new instance of Partials.
Constructor Details
#initialize ⇒ Partials
Returns a new instance of Partials.
5 6 7 |
# File 'lib/handlebars/partials.rb', line 5 def initialize @partials = {} end |
Instance Attribute Details
#partial_missing ⇒ Object
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 |