Class: Dramavladimir::Repertoire
- Inherits:
-
Object
- Object
- Dramavladimir::Repertoire
- Defined in:
- lib/dramavladimir/repertoire.rb
Instance Attribute Summary collapse
-
#announce ⇒ Object
Returns the value of attribute announce.
-
#announce_content ⇒ Object
writeonly
Sets the attribute announce_content.
-
#doc ⇒ Object
writeonly
Sets the attribute doc.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #get_afisha_links ⇒ Object
-
#initialize(attributes = {}) ⇒ Repertoire
constructor
A new instance of Repertoire.
- #spectacles ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Repertoire
Returns a new instance of Repertoire.
8 9 10 11 |
# File 'lib/dramavladimir/repertoire.rb', line 8 def initialize(attributes = {}) @url = "http://www.dramavladimir.ru/playbill" doc end |
Instance Attribute Details
#announce ⇒ Object
Returns the value of attribute announce.
6 7 8 |
# File 'lib/dramavladimir/repertoire.rb', line 6 def announce @announce end |
#announce_content=(value) ⇒ Object
Sets the attribute announce_content
6 7 8 |
# File 'lib/dramavladimir/repertoire.rb', line 6 def announce_content=(value) @announce_content = value end |
#doc=(value) ⇒ Object
Sets the attribute doc
6 7 8 |
# File 'lib/dramavladimir/repertoire.rb', line 6 def doc=(value) @doc = value end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/dramavladimir/repertoire.rb', line 6 def url @url end |
Instance Method Details
#get_afisha_links ⇒ Object
33 34 35 |
# File 'lib/dramavladimir/repertoire.rb', line 33 def get_afisha_links doc.search('#main-mid table.blog a.contentpagetitle').map { |e| e.attribute('href').value } end |
#spectacles ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dramavladimir/repertoire.rb', line 13 def spectacles spectacles = [] get_afisha_links.each do |link| announces = Dramavladimir.parse("http://www.dramavladimir.ru/#{link}") announces.search('.mceItemTable tr').each do |announce| @announce = announce next unless prepare_date spectacles.push({ title: prepare_title, scene: prepare_scene, content: prepare_content, video: prepare_video, images: prepare_images, schedules: prepare_date }) end end spectacles end |