Class: BCDice::CommonCommand::RerollDice::Node::Dice
- Inherits:
-
Object
- Object
- BCDice::CommonCommand::RerollDice::Node::Dice
- Defined in:
- lib/bcdice/common_command/reroll_dice/node.rb
Instance Attribute Summary collapse
-
#sides ⇒ Object
readonly
Returns the value of attribute sides.
-
#times ⇒ Object
readonly
Returns the value of attribute times.
Instance Method Summary collapse
-
#initialize(times, sides) ⇒ Dice
constructor
A new instance of Dice.
- #roll(randomizer) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(times, sides) ⇒ Dice
Returns a new instance of Dice.
182 183 184 185 |
# File 'lib/bcdice/common_command/reroll_dice/node.rb', line 182 def initialize(times, sides) @times = times @sides = sides end |
Instance Attribute Details
#sides ⇒ Object (readonly)
Returns the value of attribute sides.
180 181 182 |
# File 'lib/bcdice/common_command/reroll_dice/node.rb', line 180 def sides @sides end |
#times ⇒ Object (readonly)
Returns the value of attribute times.
180 181 182 |
# File 'lib/bcdice/common_command/reroll_dice/node.rb', line 180 def times @times end |
Instance Method Details
#roll(randomizer) ⇒ Object
187 188 189 |
# File 'lib/bcdice/common_command/reroll_dice/node.rb', line 187 def roll(randomizer) randomizer.(times, sides) end |
#to_s ⇒ Object
191 192 193 |
# File 'lib/bcdice/common_command/reroll_dice/node.rb', line 191 def to_s "#{times}R#{sides}" end |