Class: SoMeter
- Inherits:
-
Object
- Object
- SoMeter
- Defined in:
- lib/someter.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#reviews ⇒ Object
Returns the value of attribute reviews.
-
#string ⇒ Object
Returns the value of attribute string.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(options) ⇒ SoMeter
constructor
A new instance of SoMeter.
- #print ⇒ Object
- #print_review(index) ⇒ Object
- #print_reviews ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(options) ⇒ SoMeter
Returns a new instance of SoMeter.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/someter.rb', line 13 def initialize() @url = [:url] unless [:url].nil? @string = [:string] unless [:string].nil? if(!@url.nil?) @doc = nokogiri_doc elsif(!@string.nil?) @doc = Nokogiri::HTML(@string.force_encoding('utf-8')) end so_meter_it end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
11 12 13 |
# File 'lib/someter.rb', line 11 def doc @doc end |
#reviews ⇒ Object
Returns the value of attribute reviews.
11 12 13 |
# File 'lib/someter.rb', line 11 def reviews @reviews end |
#string ⇒ Object
Returns the value of attribute string.
11 12 13 |
# File 'lib/someter.rb', line 11 def string @string end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/someter.rb', line 11 def url @url end |
Instance Method Details
#print ⇒ Object
35 36 37 38 |
# File 'lib/someter.rb', line 35 def print puts @reviews[:dimensions].to_s puts @reviews[:aggregates].to_s end |
#print_review(index) ⇒ Object
27 28 29 |
# File 'lib/someter.rb', line 27 def print_review(index) end |
#print_reviews ⇒ Object
24 25 |
# File 'lib/someter.rb', line 24 def print_reviews end |
#to_json ⇒ Object
31 32 33 |
# File 'lib/someter.rb', line 31 def to_json @reviews.to_json end |