Class: FSM::Util::Const

Inherits:
Object
  • Object
show all
Defined in:
lib/fsm-0.0.0/util.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s) ⇒ Const


26
27
28
29
# File 'lib/fsm-0.0.0/util.rb', line 26

def initialize s 
  @to_s = s.to_s 
  freeze
end

Instance Attribute Details

#to_sObject (readonly) Also known as: to_str, inspect

Returns the value of attribute to_s


22
23
24
# File 'lib/fsm-0.0.0/util.rb', line 22

def to_s
  @to_s
end

Class Method Details

.new(s) ⇒ Object


17
18
19
20
# File 'lib/fsm-0.0.0/util.rb', line 17

def self.new s 
  s = s.to_s
  (@instances ||= {})[s] ||= super(s)
end