class Html

Constants

HOME_FOLDER

Public Instance Methods

export(headlines) click to toggle source
# File lib/html.rb, line 7
def export(headlines)
  Mustache.template_file = File.dirname(__FILE__) + '/templates/news_feed.mustache'
  view = Mustache.new
  view[:channels] = to_channel_array(headlines)
  view[:generated_at] = Time.now.strftime('%d/%m/%Y %H:%M')

  file_name = "#{HOME_FOLDER}/lideo_news_feed.html"
  open(file_name, 'w') { |f|
    f.write(view.render)
  }

  file_name
end
to_channel_array(headlines) click to toggle source
# File lib/html.rb, line 21
def to_channel_array(headlines)
  headlines.collect { |key, value| Channel.new(key, value) }
end