Class: TopTv::Heading
- Inherits:
-
Object
- Object
- TopTv::Heading
- Defined in:
- lib/top_tv/heading.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#shows ⇒ Object
Returns the value of attribute shows.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, shows) ⇒ Heading
constructor
A new instance of Heading.
Constructor Details
#initialize(name, shows) ⇒ Heading
Returns a new instance of Heading.
13 14 15 16 17 |
# File 'lib/top_tv/heading.rb', line 13 def initialize(name, shows) @name = name @shows = shows @@all << self end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/top_tv/heading.rb', line 2 def name @name end |
#shows ⇒ Object
Returns the value of attribute shows.
2 3 4 |
# File 'lib/top_tv/heading.rb', line 2 def shows @shows end |
Class Method Details
.all ⇒ Object
19 20 21 |
# File 'lib/top_tv/heading.rb', line 19 def self.all @@all end |
.new_from_home_page(heading) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/top_tv/heading.rb', line 6 def self.new_from_home_page(heading) self.new( heading.css("h2").text.gsub(" on RT", ""), heading.css("tr td.middle_col a").collect {|show| show.text.gsub(" View All ", "").gsub(",", "")}.join(",").split(",") ) end |