Class: BCDice::DiceTable::RollResult
- Inherits:
-
Object
- Object
- BCDice::DiceTable::RollResult
show all
- Defined in:
- lib/bcdice/dice_table/roll_result.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(table_name, value, body) ⇒ RollResult
Returns a new instance of RollResult.
9
10
11
12
13
|
# File 'lib/bcdice/dice_table/roll_result.rb', line 9
def initialize(table_name, value, body)
@table_name = table_name
@value = value
@body = body
end
|
Instance Attribute Details
22
23
24
|
# File 'lib/bcdice/dice_table/roll_result.rb', line 22
def body
@body
end
|
#table_name ⇒ String
16
17
18
|
# File 'lib/bcdice/dice_table/roll_result.rb', line 16
def table_name
@table_name
end
|
#value ⇒ Integer
19
20
21
|
# File 'lib/bcdice/dice_table/roll_result.rb', line 19
def value
@value
end
|
Instance Method Details
#empty? ⇒ false
一部のゲームシステムが String#empty? を想定してチェックしているため
40
41
42
|
# File 'lib/bcdice/dice_table/roll_result.rb', line 40
def empty?
false
end
|
#last_body ⇒ String
30
31
32
33
34
35
36
|
# File 'lib/bcdice/dice_table/roll_result.rb', line 30
def last_body
if @body.is_a?(RollResult)
@body.last_body
else
@body
end
end
|
#to_s ⇒ String
25
26
27
|
# File 'lib/bcdice/dice_table/roll_result.rb', line 25
def to_s
"#{@table_name}(#{@value}) > #{@body}"
end
|