Class: BCDice::DiceTable::RollResult
- Inherits:
-
Object
- Object
- BCDice::DiceTable::RollResult
- Defined in:
- lib/bcdice/dice_table/roll_result.rb
Instance Attribute Summary collapse
- #body ⇒ String, RollResult readonly
- #table_name ⇒ String readonly
- #value ⇒ Integer readonly
Instance Method Summary collapse
-
#empty? ⇒ false
一部のゲームシステムが String#empty? を想定してチェックしているため.
-
#initialize(table_name, value, body) ⇒ RollResult
constructor
A new instance of RollResult.
- #last_body ⇒ String
- #to_s ⇒ String
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
#body ⇒ String, RollResult (readonly)
22 23 24 |
# File 'lib/bcdice/dice_table/roll_result.rb', line 22 def body @body end |
#table_name ⇒ String (readonly)
16 17 18 |
# File 'lib/bcdice/dice_table/roll_result.rb', line 16 def table_name @table_name end |
#value ⇒ Integer (readonly)
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 |