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.



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

def initialize(part)
  @value = part
end

Instance Attribute Details

#valueObject (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

#inspectObject



20
21
22
# File 'lib/dicebag/simple_part.rb', line 20

def inspect
  "<#{self.class.name} #{self}>"
end

#resultObject



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

def result
  value
end

#to_sObject



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

def to_s
  value
end