Class: DiceBag::SimplePart

Inherits:
Object
  • Object
show all
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

LabelPart, RollPart, StaticPart

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(part) ⇒ SimplePart

Returns a new instance of SimplePart.



9
10
11
# File 'lib/dicebag/simple_part.rb', line 9

def initialize(part)
  @value = part
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/dicebag/simple_part.rb', line 7

def value
  @value
end

Instance Method Details

#resultObject



13
14
15
# File 'lib/dicebag/simple_part.rb', line 13

def result
  value
end

#to_sObject



17
18
19
# File 'lib/dicebag/simple_part.rb', line 17

def to_s
  value
end