Class: BCDice::CommonCommand::UpperDice::Node::Notation

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

Instance Method Summary collapse

Constructor Details

#initialize(roll_times, sides) ⇒ Notation

Returns a new instance of Notation.

Parameters:

  • roll_times (Object)
  • sides (Object)


119
120
121
122
# File 'lib/bcdice/common_command/upper_dice/node.rb', line 119

def initialize(roll_times, sides)
  @roll_times = roll_times
  @sides = sides
end

Instance Method Details

#to_dice(round_type) ⇒ Dice

Parameters:

  • round_type (Symbol)

Returns:



126
127
128
129
130
131
# File 'lib/bcdice/common_command/upper_dice/node.rb', line 126

def to_dice(round_type)
  roll_times = @roll_times.eval(round_type)
  sides = @sides.eval(round_type)

  Dice.new(roll_times, sides)
end