Module: RollString

Included in:
DiceBag::Roll
Defined in:
lib/dicebag/roll_string.rb

Overview

This encapsulates the Roll class’ string generation methods.

Instance Method Summary collapse

Instance Method Details

#inspectObject



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

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

#to_s(no_spaces = false) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/dicebag/roll_string.rb', line 3

def to_s(no_spaces = false)
  @parts = []

  to_s_tree

  str = @parts.join ' '

  no_spaces ? str.tr(' ', '') : str
end