Class: WhatIMean::Find
- Inherits:
-
Object
- Object
- WhatIMean::Find
- Defined in:
- lib/whatimean/find.rb
Overview
Find
The Core of WhatIMean, this class interacts with Google and Word and fetch the search returning each word with hits, name and rate comparison
Instance Attribute Summary collapse
-
#words ⇒ Object
readonly
Returns the value of attribute words.
Instance Method Summary collapse
-
#initialize(client, *words) ⇒ Find
constructor
Compare strings and return a list ordered by occurence.
-
#winner ⇒ Word
Returns the word in comparison with most results.
Constructor Details
#initialize(client, *words) ⇒ Find
Compare strings and return a list ordered by occurence
12 13 14 15 |
# File 'lib/whatimean/find.rb', line 12 def initialize(client, *words) @client = client @words = fetch_words(words).sort { |x,y| y.hits <=> x.hits } end |
Instance Attribute Details
#words ⇒ Object (readonly)
Returns the value of attribute words.
6 7 8 |
# File 'lib/whatimean/find.rb', line 6 def words @words end |
Instance Method Details
#winner ⇒ Word
Returns the word in comparison with most results
19 20 21 |
# File 'lib/whatimean/find.rb', line 19 def winner @words.first end |