Class: BagOfHolding::Dice::Constant
- Inherits:
-
Object
- Object
- BagOfHolding::Dice::Constant
- Defined in:
- lib/bag_of_holding/dice/constant.rb
Overview
Internal: Stores a constant value with a rollable API so that this object can be called like a pool or operation.
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(value:) ⇒ Constant
constructor
A new instance of Constant.
- #roll ⇒ Object
Constructor Details
#initialize(value:) ⇒ Constant
Returns a new instance of Constant.
8 9 10 |
# File 'lib/bag_of_holding/dice/constant.rb', line 8 def initialize(value:) self.value = value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/bag_of_holding/dice/constant.rb', line 6 def value @value end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 19 20 |
# File 'lib/bag_of_holding/dice/constant.rb', line 16 def ==(other) return false unless other.respond_to? :value return false unless value == other.value true end |
#roll ⇒ Object
12 13 14 |
# File 'lib/bag_of_holding/dice/constant.rb', line 12 def roll BagOfHolding::Dice::ConstantResult.new value: value end |