Class: Yharian::Speaker
- Inherits:
-
Object
show all
- Defined in:
- lib/plugin/yhara.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name) ⇒ Speaker
18
19
20
|
# File 'lib/plugin/yhara.rb', line 18
def initialize(name)
@name = name
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
17
18
19
|
# File 'lib/plugin/yhara.rb', line 17
def name
@name
end
|
Instance Method Details
#talk(context) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/plugin/yhara.rb', line 22
def talk(context)
n = 7
words = (0..rand(n)).map { %w[y hara].choice }.
inject {|r, e| r + (rand < 0.97 ? ' ' : ', ') + e }
eos = %w(? ? . . . . . . . . !).choice
[.new(self,words, eos)]
end
|
#voice(context = nil) ⇒ Object
30
31
32
|
# File 'lib/plugin/yhara.rb', line 30
def voice(context = nil)
@name
end
|