Class: FSM::Util::Const
- Inherits:
-
Object
- Object
- FSM::Util::Const
- Defined in:
- lib/fsm-0.0.0/util.rb
Instance Attribute Summary collapse
-
#to_s ⇒ Object
(also: #to_str, #inspect)
readonly
Returns the value of attribute to_s.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(s) ⇒ Const
constructor
A new instance of Const.
Constructor Details
#initialize(s) ⇒ Const
Returns a new instance of 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_s ⇒ Object (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 |