Class: SoMeter

Inherits:
Object
  • Object
show all
Defined in:
lib/someter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options) 
  @url = options[:url] unless options[:url].nil? 
  @string = options[:string] unless options[: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

#docObject

Returns the value of attribute doc.



11
12
13
# File 'lib/someter.rb', line 11

def doc
  @doc
end

#reviewsObject

Returns the value of attribute reviews.



11
12
13
# File 'lib/someter.rb', line 11

def reviews
  @reviews
end

#stringObject

Returns the value of attribute string.



11
12
13
# File 'lib/someter.rb', line 11

def string
  @string
end

#urlObject

Returns the value of attribute url.



11
12
13
# File 'lib/someter.rb', line 11

def url
  @url
end

Instance Method Details



35
36
37
38
# File 'lib/someter.rb', line 35

def print
  puts @reviews[:dimensions].to_s
  puts @reviews[:aggregates].to_s
end


27
28
29
# File 'lib/someter.rb', line 27

def print_review(index)  
    
end


24
25
# File 'lib/someter.rb', line 24

def print_reviews  
end

#to_jsonObject



31
32
33
# File 'lib/someter.rb', line 31

def to_json
  @reviews.to_json
end