Class: Flex::Template::Partial
- Inherits:
-
Object
- Object
- Flex::Template::Partial
- Includes:
- Common
- Defined in:
- lib/flex/template/partial.rb
Instance Attribute Summary
Attributes included from Common
#data, #name, #partials, #tags
Instance Method Summary collapse
-
#initialize(data) ⇒ Partial
constructor
A new instance of Partial.
- #to_source ⇒ Object
Methods included from Common
Constructor Details
#initialize(data) ⇒ Partial
Returns a new instance of Partial.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/flex/template/partial.rb', line 7 def initialize(data) @data = data = Tags.new stringified = .stringify(data) @partials, @tags = .partial_and_tag_names @tags_variables = .variables instance_eval <<-ruby, __FILE__, __LINE__ def interpolate(vars={}, partial_assigned_vars={}) vars = Vars.new(vars, @tags_variables, partial_assigned_vars) vars = interpolate_partials(vars) #{stringified} end ruby end |
Instance Method Details
#to_source ⇒ Object
22 23 24 |
# File 'lib/flex/template/partial.rb', line 22 def to_source {@name.to_s => @data}.to_yaml end |