Class: Phrase::Pronunciation

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

Overview

a container of word, pronunciation_id, num_syllables, and rhyme_key

Instance Attribute Summary collapse

Instance Method Summary collapse

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_syllablesObject (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_idObject (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_keyObject (readonly)

Returns the value of attribute rhyme_key.



193
194
195
# File 'lib/ruby_rhymes.rb', line 193

def rhyme_key
  @rhyme_key
end

#wordObject (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?

Returns:

  • (Boolean)


203
204
205
# File 'lib/ruby_rhymes.rb', line 203

def dict?
  !!@pronunciation_id
end

#to_sObject



207
208
209
# File 'lib/ruby_rhymes.rb', line 207

def to_s
  word
end