Class: DiceBag::StaticPart

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

#value

Instance Method Summary collapse

Methods inherited from SimplePart

#result

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

#inspectObject



24
25
26
# File 'lib/dicebag/static_part.rb', line 24

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

#to_sObject



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

def to_s
  value.to_s
end

#totalObject Also known as: average, maximum, minimum



11
12
13
# File 'lib/dicebag/static_part.rb', line 11

def total
  value
end