Class: Yharian::Speaker
- Inherits:
-
Object
show all
- Defined in:
- lib/plugins/yhara.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name) ⇒ Speaker
20
21
22
|
# File 'lib/plugins/yhara.rb', line 20
def initialize(name)
@name = name
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
19
20
21
|
# File 'lib/plugins/yhara.rb', line 19
def name
@name
end
|
Instance Method Details
#talk(context) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/plugins/yhara.rb', line 24
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
32
33
34
|
# File 'lib/plugins/yhara.rb', line 32
def voice(context = nil)
@name
end
|