Class: ProgramTV::Writer
- Inherits:
-
Object
- Object
- ProgramTV::Writer
- Defined in:
- lib/program-tv/writer.rb
Instance Method Summary collapse
-
#initialize(data) ⇒ Writer
constructor
A new instance of Writer.
-
#run ⇒ Object
Runs dynamic-sprites command.
Constructor Details
#initialize(data) ⇒ Writer
6 7 8 9 10 |
# File 'lib/program-tv/writer.rb', line 6 def initialize(data) @data = data @xml = Builder::XmlMarkup.new( :indent => 2 ) @xml.instruct! :xml, :encoding => "UTF-8" end |
Instance Method Details
#run ⇒ Object
Runs dynamic-sprites command.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/program-tv/writer.rb', line 14 def run @xml.tv do |tv| @data.flatten.each do |element| tv.programme do |p| p.title element[:title] p.channel element[:channel] p.start element[:start] p.end element[:end] end end end end |