Class: Yharian::Remark
- Inherits:
-
Object
- Object
- Yharian::Remark
- Defined in:
- lib/plugins/yhara.rb
Instance Attribute Summary collapse
-
#eos ⇒ Object
readonly
Returns the value of attribute eos.
-
#pronounciation ⇒ Object
readonly
Returns the value of attribute pronounciation.
-
#speaker ⇒ Object
readonly
Returns the value of attribute speaker.
-
#words ⇒ Object
readonly
Returns the value of attribute words.
Instance Method Summary collapse
- #correct?(s) ⇒ Boolean
- #display ⇒ Object
-
#initialize(speaker, words, eos, options = {}) ⇒ Remark
constructor
A new instance of Remark.
- #interrogative? ⇒ Boolean
- #say(context = nil) ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(speaker, words, eos, options = {}) ⇒ Remark
Returns a new instance of Remark.
81 82 83 84 85 86 |
# File 'lib/plugins/yhara.rb', line 81 def initialize(speaker, words, eos, = {}) @speaker = speaker @words = words @eos = eos # end of text : "?" or "." or "!" @pronounciation = [:pronounciation] || text end |
Instance Attribute Details
#eos ⇒ Object (readonly)
Returns the value of attribute eos.
79 80 81 |
# File 'lib/plugins/yhara.rb', line 79 def eos @eos end |
#pronounciation ⇒ Object (readonly)
Returns the value of attribute pronounciation.
79 80 81 |
# File 'lib/plugins/yhara.rb', line 79 def pronounciation @pronounciation end |
#speaker ⇒ Object (readonly)
Returns the value of attribute speaker.
79 80 81 |
# File 'lib/plugins/yhara.rb', line 79 def speaker @speaker end |
#words ⇒ Object (readonly)
Returns the value of attribute words.
79 80 81 |
# File 'lib/plugins/yhara.rb', line 79 def words @words end |
Instance Method Details
#correct?(s) ⇒ Boolean
104 105 106 |
# File 'lib/plugins/yhara.rb', line 104 def correct?(s) s.gsub(/[^yhar]/,'') == @words.gsub(/[^yhar]/,'') end |
#display ⇒ Object
96 97 98 |
# File 'lib/plugins/yhara.rb', line 96 def display puts "#{@speaker.name}: #{text}" end |
#interrogative? ⇒ Boolean
92 93 94 |
# File 'lib/plugins/yhara.rb', line 92 def interrogative? @eos == '?' end |
#say(context = nil) ⇒ Object
100 101 102 |
# File 'lib/plugins/yhara.rb', line 100 def say(context = nil) Kernel.say pronounciation, :voice => @speaker.voice(context) end |
#text ⇒ Object
88 89 90 |
# File 'lib/plugins/yhara.rb', line 88 def text @words + @eos end |