Class: DiceBox::Dice::Side

Inherits:
Object
  • Object
show all
Defined in:
lib/dice_box/dice/side.rb

Overview

Representation of the side of a dice

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, weight = 1.0) ⇒ Side

Returns a new instance of Side.

Parameters:

  • value (Integer)

    the actual value of the Side

  • weight (Float) (defaults to: 1.0)

    the weight of the Side



15
16
17
18
# File 'lib/dice_box/dice/side.rb', line 15

def initialize(value, weight = 1.0)
  @value = value
  @weight = weight
end

Instance Attribute Details

#valueInteger

Returns the actual value of the Side.

Returns:

  • (Integer)

    the actual value of the Side



7
8
9
# File 'lib/dice_box/dice/side.rb', line 7

def value
  @value
end

#weightFloat

Returns the weight of the Side.

Returns:

  • (Float)

    the weight of the Side



11
12
13
# File 'lib/dice_box/dice/side.rb', line 11

def weight
  @weight
end