Class: Dramavladimir::Announce
- Inherits:
-
Object
- Object
- Dramavladimir::Announce
- Defined in:
- lib/dramavladimir/announce.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
writeonly
Sets the attribute doc.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #content ⇒ Object
- #images ⇒ Object
-
#initialize(url, attributes = {}) ⇒ Announce
constructor
A new instance of Announce.
- #video ⇒ Object
Constructor Details
#initialize(url, attributes = {}) ⇒ Announce
Returns a new instance of Announce.
5 6 7 |
# File 'lib/dramavladimir/announce.rb', line 5 def initialize(url, attributes = {}) @url = url end |
Instance Attribute Details
#doc=(value) ⇒ Object
Sets the attribute doc
3 4 5 |
# File 'lib/dramavladimir/announce.rb', line 3 def doc=(value) @doc = value end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/dramavladimir/announce.rb', line 3 def url @url end |
Instance Method Details
#content ⇒ Object
9 10 11 |
# File 'lib/dramavladimir/announce.rb', line 9 def content doc.css('#main-mid p').map { |c| c.inner_text }.join('<br />').gsub(/\n|\t/, '').sub(/title=.JoomlaWorks AllVideos Player.>/, '') end |
#images ⇒ Object
18 19 20 21 |
# File 'lib/dramavladimir/announce.rb', line 18 def images return if doc.nil? || doc.css('.rokbox-album-inner').empty? doc.css('.rokbox-album-inner a').map { |image| "#{@site}#{image.attribute('href').value}" } end |
#video ⇒ Object
13 14 15 16 |
# File 'lib/dramavladimir/announce.rb', line 13 def video return if doc.css('.avPlayerWrapper.avVideo').empty? doc.at_css('.avPlayerWrapper.avVideo iframe').attribute('src').value end |