Class: DiceBag::StaticPart
- Inherits:
-
SimplePart
- Object
- SimplePart
- DiceBag::StaticPart
- Defined in:
- lib/dicebag/static_part.rb
Overview
This represents a static, non-random number part of the dice string.
Instance Attribute Summary
Attributes inherited from SimplePart
Instance Method Summary collapse
-
#initialize(num) ⇒ StaticPart
constructor
A new instance of StaticPart.
- #inspect ⇒ Object
- #to_s ⇒ Object
- #total ⇒ Object (also: #average, #maximum, #minimum)
Methods inherited from SimplePart
Constructor Details
#initialize(num) ⇒ StaticPart
Returns a new instance of StaticPart.
5 6 7 8 9 |
# File 'lib/dicebag/static_part.rb', line 5 def initialize(num) num = num.to_i if num.is_a?(String) super(num) end |
Instance Method Details
#inspect ⇒ Object
24 25 26 |
# File 'lib/dicebag/static_part.rb', line 24 def inspect "<#{self.class.name} #{self}>" end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/dicebag/static_part.rb', line 20 def to_s value.to_s end |
#total ⇒ Object Also known as: average, maximum, minimum
11 12 13 |
# File 'lib/dicebag/static_part.rb', line 11 def total value end |