Class: Sheng::WMLFile
- Inherits:
-
Object
- Object
- Sheng::WMLFile
- Defined in:
- lib/sheng/wml_file.rb
Defined Under Namespace
Classes: InvalidWML
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
-
#initialize(filename, xml) ⇒ WMLFile
constructor
A new instance of WMLFile.
- #interpolate(data_set) ⇒ Object
- #parent_set ⇒ Object
- #required_hash ⇒ Object
- #to_tree ⇒ Object
Constructor Details
#initialize(filename, xml) ⇒ WMLFile
Returns a new instance of WMLFile.
7 8 9 10 11 |
# File 'lib/sheng/wml_file.rb', line 7 def initialize(filename, xml) @filename = filename @xml = Nokogiri::XML(xml) @errors = {} end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/sheng/wml_file.rb', line 5 def errors @errors end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
5 6 7 |
# File 'lib/sheng/wml_file.rb', line 5 def filename @filename end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
5 6 7 |
# File 'lib/sheng/wml_file.rb', line 5 def xml @xml end |
Instance Method Details
#interpolate(data_set) ⇒ Object
13 14 15 16 17 |
# File 'lib/sheng/wml_file.rb', line 13 def interpolate(data_set) parent_set.interpolate(data_set) errors.merge!(parent_set.errors) parent_set.xml_fragment.to_s end |
#parent_set ⇒ Object
19 20 21 |
# File 'lib/sheng/wml_file.rb', line 19 def parent_set @parent_set ||= MergeFieldSet.new('main', xml) end |
#required_hash ⇒ Object
23 24 25 |
# File 'lib/sheng/wml_file.rb', line 23 def required_hash parent_set.required_hash end |
#to_tree ⇒ Object
27 28 29 |
# File 'lib/sheng/wml_file.rb', line 27 def to_tree parent_set.to_tree end |