Class: Onsen
Instance Method Summary collapse
- #download ⇒ Object
- #dump ⇒ Object
-
#initialize(params, options) ⇒ Onsen
constructor
A new instance of Onsen.
Methods inherited from WebRadio
Constructor Details
#initialize(params, options) ⇒ Onsen
Returns a new instance of Onsen.
7 8 9 10 |
# File 'lib/onsen.rb', line 7 def initialize(params, ) super @cover = "//*[@id='newProgramWrap']//img[1]/@src" unless @cover end |
Instance Method Details
#download ⇒ Object
12 13 14 |
# File 'lib/onsen.rb', line 12 def download onsen_download(@label, @url.scan(%r|/([^/]*)/$|).flatten.first) end |
#dump ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/onsen.rb', line 16 def dump tag = Pathname(@url).basename.to_s.gsub(%r|[-/]|, '_') html = Nokogiri(open(@url, &:read)) title = html.css('#outLineWrap h1').text return { tag => { 'desc' => title, 'url' => @url, 'label' => tag } } end |