Class: DiceBag::SimplePart
- Inherits:
-
Object
- Object
- DiceBag::SimplePart
- Defined in:
- lib/dicebag/simple_part.rb
Overview
The most simplest of a part. If a given part of a dice string is not a Label, Fixnum, or a xDx part it will be an instance of this class, which simply returns the value given to it.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(part) ⇒ SimplePart
constructor
A new instance of SimplePart.
- #inspect ⇒ Object
- #result ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(part) ⇒ SimplePart
Returns a new instance of SimplePart.
8 9 10 |
# File 'lib/dicebag/simple_part.rb', line 8 def initialize(part) @value = part end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/dicebag/simple_part.rb', line 6 def value @value end |
Instance Method Details
#inspect ⇒ Object
20 21 22 |
# File 'lib/dicebag/simple_part.rb', line 20 def inspect "<#{self.class.name} #{self}>" end |
#result ⇒ Object
12 13 14 |
# File 'lib/dicebag/simple_part.rb', line 12 def result value end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/dicebag/simple_part.rb', line 16 def to_s value end |