Module: Flex::Template::Common
- Included in:
- Flex::Template, Partial
- Defined in:
- lib/flex/template/common.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#partials ⇒ Object
readonly
Returns the value of attribute partials.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/flex/template/common.rb', line 5 def data @data end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/flex/template/common.rb', line 5 def name @name end |
#partials ⇒ Object (readonly)
Returns the value of attribute partials.
5 6 7 |
# File 'lib/flex/template/common.rb', line 5 def partials @partials end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
5 6 7 |
# File 'lib/flex/template/common.rb', line 5 def @tags end |
Instance Method Details
#interpolate_partials(vars) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/flex/template/common.rb', line 14 def interpolate_partials(vars) @partials.each do |name| partial_assigned_vars = vars[name] next if Prunable::VALUES.include?(partial_assigned_vars) vars[name] = case partial_assigned_vars when Array partial_assigned_vars.map {|v| @host_flex.partials[name].interpolate(vars, v)} # other partial name (usable as a case output) when Symbol @host_flex.partials[partial_assigned_vars].interpolate(vars, vars[partial_assigned_vars]) # a partial object when Template::Partial partial_assigned_vars.interpolate(vars, vars) # on-the-fly partial creation (an empty string would prune it before) when String Template::Partial.new(partial_assigned_vars).interpolate(vars, vars) # switch to include the partial (a false value would prune it before) when TrueClass @host_flex.partials[name].interpolate(vars, vars) else @host_flex.partials[name].interpolate(vars, partial_assigned_vars) end end vars end |