Class: BCDice::CommonCommand::TallyDice::Node::Notation

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

Overview

個数カウントダイス:ダイス表記のノード

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(times:, sides:, show_zeros:) ⇒ Notation



79
80
81
82
83
# File 'lib/bcdice/common_command/tally_dice/node.rb', line 79

def initialize(times:, sides:, show_zeros:)
  @times = times
  @sides = sides
  @show_zeros = show_zeros
end

Instance Attribute Details

#show_zerosBoolean (readonly)



74
75
76
# File 'lib/bcdice/common_command/tally_dice/node.rb', line 74

def show_zeros
  @show_zeros
end

#sidesInteger (readonly)



72
73
74
# File 'lib/bcdice/common_command/tally_dice/node.rb', line 72

def sides
  @sides
end

#timesInteger (readonly)



70
71
72
# File 'lib/bcdice/common_command/tally_dice/node.rb', line 70

def times
  @times
end

Instance Method Details

#to_dice(round_type) ⇒ Dice



87
88
89
90
91
92
# File 'lib/bcdice/common_command/tally_dice/node.rb', line 87

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

  Dice.new(times: times, sides: sides, show_zeros: @show_zeros)
end