Class: Yharian::Remark
- Inherits:
-
Object
- Object
- Yharian::Remark
- Defined in:
- lib/plugin/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.
79 80 81 82 83 84 |
# File 'lib/plugin/yhara.rb', line 79 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.
77 78 79 |
# File 'lib/plugin/yhara.rb', line 77 def eos @eos end |
#pronounciation ⇒ Object (readonly)
Returns the value of attribute pronounciation.
77 78 79 |
# File 'lib/plugin/yhara.rb', line 77 def pronounciation @pronounciation end |
#speaker ⇒ Object (readonly)
Returns the value of attribute speaker.
77 78 79 |
# File 'lib/plugin/yhara.rb', line 77 def speaker @speaker end |
#words ⇒ Object (readonly)
Returns the value of attribute words.
77 78 79 |
# File 'lib/plugin/yhara.rb', line 77 def words @words end |
Instance Method Details
#correct?(s) ⇒ Boolean
102 103 104 |
# File 'lib/plugin/yhara.rb', line 102 def correct?(s) s.gsub(/[^yhar]/,'') == @words.gsub(/[^yhar]/,'') end |
#display ⇒ Object
94 95 96 |
# File 'lib/plugin/yhara.rb', line 94 def display puts "#{@speaker.name}: #{text}" end |
#interrogative? ⇒ Boolean
90 91 92 |
# File 'lib/plugin/yhara.rb', line 90 def interrogative? @eos == '?' end |
#say(context = nil) ⇒ Object
98 99 100 |
# File 'lib/plugin/yhara.rb', line 98 def say(context = nil) Kernel.say pronounciation, :voice => @speaker.voice(context) end |
#text ⇒ Object
86 87 88 |
# File 'lib/plugin/yhara.rb', line 86 def text @words + @eos end |