Class: Kijkwijzer::Result
- Inherits:
-
Object
- Object
- Kijkwijzer::Result
- Defined in:
- lib/kijkwijzer/result.rb
Instance Attribute Summary collapse
-
#production_type ⇒ Object
Returns the value of attribute production_type.
-
#ratings ⇒ String
Get the ratings for the result.
-
#title ⇒ Object
Returns the value of attribute title.
-
#year ⇒ Object
Returns the value of attribute year.
Class Method Summary collapse
Instance Method Summary collapse
-
#match_filter?(filter) ⇒ TrueClass, FalseClass
Filters use a key value hash to which the results should conform.
- #to_s ⇒ Object
Instance Attribute Details
#production_type ⇒ Object
Returns the value of attribute production_type.
4 5 6 |
# File 'lib/kijkwijzer/result.rb', line 4 def production_type @production_type end |
#ratings ⇒ String
Get the ratings for the result
11 12 13 |
# File 'lib/kijkwijzer/result.rb', line 11 def @ratings end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/kijkwijzer/result.rb', line 3 def title @title end |
#year ⇒ Object
Returns the value of attribute year.
5 6 7 |
# File 'lib/kijkwijzer/result.rb', line 5 def year @year end |
Class Method Details
.new_from_nokogiri_result_fragment(nokogiri_result_fragment) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/kijkwijzer/result.rb', line 34 def new_from_nokogiri_result_fragment nokogiri_result_fragment r = self.new r.title = nokogiri_result_fragment.css('b').text production_type_match = nokogiri_result_fragment.text.match(/Productietype\:\s(.*)\.(\sProductie)/) production_year_match = nokogiri_result_fragment.text.match(/\sProductiejaar\:\s(\d\d\d\d)\.\s/) r.year = production_year_match[1].to_i if production_year_match r.production_type = production_type_match[1] if production_type_match r. = nokogiri_result_fragment.css("img").collect{|a| a.attr("src").match(/\/upload\/pictogrammen\/\d*_\d*_(.*)\.png/)[1]} return r end |
Instance Method Details
#match_filter?(filter) ⇒ TrueClass, FalseClass
Filters use a key value hash to which the results should conform
29 30 31 |
# File 'lib/kijkwijzer/result.rb', line 29 def match_filter?(filter) !(filter.collect{|k, v| include_r = (self.send(k) == v)}.include? false) end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/kijkwijzer/result.rb', line 22 def to_s "#<Kijkwijzer::Result @title=\"#{title}\", @year=#{year}>" end |