Class: BCDice::CommonCommand::BarabaraDice::Node::Dice

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

Instance Method Summary collapse

Constructor Details

#initialize(times, sides) ⇒ Dice

Returns a new instance of Dice.

Parameters:

  • times (Integer)
  • sides (Integer)


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>

Parameters:

Returns:

  • (Array<Integer>)


80
81
82
# File 'lib/bcdice/common_command/barabara_dice/node.rb', line 80

def roll(randomizer)
  randomizer.roll_barabara(@times, @sides)
end

#to_sString

Returns:

  • (String)


85
86
87
# File 'lib/bcdice/common_command/barabara_dice/node.rb', line 85

def to_s
  "#{@times}B#{@sides}"
end