Class: ConfigXML
- Inherits:
-
Object
- Object
- ConfigXML
- Includes:
- ERB::Util
- Defined in:
- lib/templatit/xml_update.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#pairs ⇒ Object
Returns the value of attribute pairs.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(pairs, template) ⇒ ConfigXML
constructor
A new instance of ConfigXML.
- #render ⇒ Object
- #save(file) ⇒ Object
Constructor Details
#initialize(pairs, template) ⇒ ConfigXML
Returns a new instance of ConfigXML.
85 86 87 88 89 |
# File 'lib/templatit/xml_update.rb', line 85 def initialize(pairs, template) @pairs = pairs puts pairs @template = template end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
83 84 85 |
# File 'lib/templatit/xml_update.rb', line 83 def date @date end |
#pairs ⇒ Object
Returns the value of attribute pairs.
83 84 85 |
# File 'lib/templatit/xml_update.rb', line 83 def pairs @pairs end |
#template ⇒ Object
Returns the value of attribute template.
83 84 85 |
# File 'lib/templatit/xml_update.rb', line 83 def template @template end |
Instance Method Details
#render ⇒ Object
91 92 93 |
# File 'lib/templatit/xml_update.rb', line 91 def render() ERB.new(@template).result(binding) end |
#save(file) ⇒ Object
95 96 97 98 99 |
# File 'lib/templatit/xml_update.rb', line 95 def save(file) File.open(file, "w+") do |f| f.write(render) end end |