Class: ConfigXML

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/templatit/xml_update.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dateObject

Returns the value of attribute date.



83
84
85
# File 'lib/templatit/xml_update.rb', line 83

def date
  @date
end

#pairsObject

Returns the value of attribute pairs.



83
84
85
# File 'lib/templatit/xml_update.rb', line 83

def pairs
  @pairs
end

#templateObject

Returns the value of attribute template.



83
84
85
# File 'lib/templatit/xml_update.rb', line 83

def template
  @template
end

Instance Method Details

#renderObject



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