Class: RandomWordByLength::Word
- Inherits:
-
Object
- Object
- RandomWordByLength::Word
- Defined in:
- lib/random_word_by_length/word.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#spelling ⇒ Object
Returns the value of attribute spelling.
-
#synonyms ⇒ Object
Returns the value of attribute synonyms.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(spelling) ⇒ Word
constructor
A new instance of Word.
Constructor Details
#initialize(spelling) ⇒ Word
Returns a new instance of Word.
5 6 7 |
# File 'lib/random_word_by_length/word.rb', line 5 def initialize(spelling) @spelling = spelling end |
Instance Attribute Details
#definition ⇒ Object
Returns the value of attribute definition.
3 4 5 |
# File 'lib/random_word_by_length/word.rb', line 3 def definition @definition end |
#kind ⇒ Object
Returns the value of attribute kind.
3 4 5 |
# File 'lib/random_word_by_length/word.rb', line 3 def kind @kind end |
#spelling ⇒ Object
Returns the value of attribute spelling.
3 4 5 |
# File 'lib/random_word_by_length/word.rb', line 3 def spelling @spelling end |
#synonyms ⇒ Object
Returns the value of attribute synonyms.
3 4 5 |
# File 'lib/random_word_by_length/word.rb', line 3 def synonyms @synonyms end |
Class Method Details
.easy ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/random_word_by_length/word.rb', line 9 def self.easy word = RandomWordByLength::Scraper.get_easy_word attributes = RandomWordByLength::Scraper.get_word_attributes(word) word = self.new(word) word.definition = attributes[0] word.kind = attributes[1] word.synonyms = "https://www.thesaurus.com/browse/#{word.spelling}" word end |
.hard ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/random_word_by_length/word.rb', line 29 def self.hard word = RandomWordByLength::Scraper.get_hard_word attributes = RandomWordByLength::Scraper.get_word_attributes(word) word = self.new(word) word.definition = attributes[0] word.kind = attributes[1] word.synonyms = "https://www.thesaurus.com/browse/#{word.spelling}" word end |
.medium ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/random_word_by_length/word.rb', line 19 def self.medium word = RandomWordByLength::Scraper.get_medium_word attributes = RandomWordByLength::Scraper.get_word_attributes(word) word = self.new(word) word.definition = attributes[0] word.kind = attributes[1] word.synonyms = "https://www.thesaurus.com/browse/#{word.spelling}" word end |