Class: Phrase::Pronunciation
- Inherits:
-
Object
- Object
- Phrase::Pronunciation
- Defined in:
- lib/ruby_rhymes.rb
Overview
a container of word, pronunciation_id, num_syllables, and rhyme_key
Instance Attribute Summary collapse
-
#num_syllables ⇒ Object
readonly
Returns the value of attribute num_syllables.
-
#pronunciation_id ⇒ Object
readonly
Returns the value of attribute pronunciation_id.
-
#rhyme_key ⇒ Object
readonly
Returns the value of attribute rhyme_key.
-
#word ⇒ Object
readonly
Returns the value of attribute word.
Instance Method Summary collapse
-
#dict? ⇒ Boolean
dictionary word?.
-
#initialize(word, pronunciation_id, num_syllables, rhyme_key) ⇒ Pronunciation
constructor
A new instance of Pronunciation.
- #to_s ⇒ Object
Constructor Details
#initialize(word, pronunciation_id, num_syllables, rhyme_key) ⇒ Pronunciation
Returns a new instance of Pronunciation.
195 196 197 198 199 200 |
# File 'lib/ruby_rhymes.rb', line 195 def initialize(word, pronunciation_id, num_syllables, rhyme_key) @word = word @pronunciation_id = pronunciation_id @num_syllables = num_syllables @rhyme_key = rhyme_key end |
Instance Attribute Details
#num_syllables ⇒ Object (readonly)
Returns the value of attribute num_syllables.
193 194 195 |
# File 'lib/ruby_rhymes.rb', line 193 def num_syllables @num_syllables end |
#pronunciation_id ⇒ Object (readonly)
Returns the value of attribute pronunciation_id.
193 194 195 |
# File 'lib/ruby_rhymes.rb', line 193 def pronunciation_id @pronunciation_id end |
#rhyme_key ⇒ Object (readonly)
Returns the value of attribute rhyme_key.
193 194 195 |
# File 'lib/ruby_rhymes.rb', line 193 def rhyme_key @rhyme_key end |
#word ⇒ Object (readonly)
Returns the value of attribute word.
193 194 195 |
# File 'lib/ruby_rhymes.rb', line 193 def word @word end |
Instance Method Details
#dict? ⇒ Boolean
dictionary word?
203 204 205 |
# File 'lib/ruby_rhymes.rb', line 203 def dict? !!@pronunciation_id end |
#to_s ⇒ Object
207 208 209 |
# File 'lib/ruby_rhymes.rb', line 207 def to_s word end |