Class: Hibiki
Instance Method Summary collapse
- #download ⇒ Object
- #dump ⇒ Object
-
#initialize(url, options) ⇒ Hibiki
constructor
A new instance of Hibiki.
Methods inherited from WebRadio
Constructor Details
#initialize(url, options) ⇒ Hibiki
Returns a new instance of Hibiki.
10 11 12 13 |
# File 'lib/hibiki.rb', line 10 def initialize(url, ) super @url = @url.sub(%r|/detail\Z|, '') end |
Instance Method Details
#download ⇒ Object
15 16 17 |
# File 'lib/hibiki.rb', line 15 def download hibiki_download(@label, Pathname(@url).basename.to_s) end |
#dump ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hibiki.rb', line 19 def dump tag = Pathname(@url).basename.to_s.gsub(%r|[-/]|, '_') agent = Mechanize.new media_info = hibiki_media_info(agent, tag) return { tag => { 'desc' => media_info[:name], 'url' => @url, 'label' => tag } } end |