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
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
19 20 21 |
# File 'lib/dicebag/static_part.rb', line 19 def inspect "<#{self.class.name} #{self}>" end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/dicebag/static_part.rb', line 15 def to_s value.to_s end |
#total ⇒ Object
11 12 13 |
# File 'lib/dicebag/static_part.rb', line 11 def total value end |