Class: BCDice::CommonCommand::BarabaraDice::Node::Dice
- Inherits:
-
Object
- Object
- BCDice::CommonCommand::BarabaraDice::Node::Dice
- Defined in:
- lib/bcdice/common_command/barabara_dice/node.rb
Instance Method Summary collapse
-
#initialize(times, sides) ⇒ Dice
constructor
A new instance of Dice.
- #roll(randomizer) ⇒ Array<Integer>
- #to_s ⇒ String
Constructor Details
#initialize(times, sides) ⇒ Dice
Returns a new instance of Dice.
73 74 75 76 |
# File 'lib/bcdice/common_command/barabara_dice/node.rb', line 73 def initialize(times, sides) @times = times @sides = sides end |
Instance Method Details
#roll(randomizer) ⇒ Array<Integer>
80 81 82 |
# File 'lib/bcdice/common_command/barabara_dice/node.rb', line 80 def roll(randomizer) randomizer.(@times, @sides) end |
#to_s ⇒ String
85 86 87 |
# File 'lib/bcdice/common_command/barabara_dice/node.rb', line 85 def to_s "#{@times}B#{@sides}" end |