Class: BCDice::CommonCommand::RerollDice::Node::Dice

Inherits:
Object
  • Object
show all
Defined in:
lib/bcdice/common_command/reroll_dice/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#sidesObject (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

#timesObject (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.roll_barabara(times, sides)
end

#to_sObject



191
192
193
# File 'lib/bcdice/common_command/reroll_dice/node.rb', line 191

def to_s
  "#{times}R#{sides}"
end