Class: LIT::Utils::MapHash Private
- Inherits:
-
Object
- Object
- LIT::Utils::MapHash
- Defined in:
- lib/lit/utils.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #values ⇒ Object readonly private
Instance Method Summary collapse
- #[](key) ⇒ Object private
- #each(&block) ⇒ Object private
-
#initialize(values) ⇒ MapHash
constructor
private
A new instance of MapHash.
- #to_h ⇒ Object private
Constructor Details
#initialize(values) ⇒ MapHash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MapHash.
16 17 18 |
# File 'lib/lit/utils.rb', line 16 def initialize(values) @values = values.transform_keys { |k| k.is_a?(Symbol) ? k.to_s : k } end |
Instance Attribute Details
#values ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/lit/utils.rb', line 14 def values @values end |
Instance Method Details
#[](key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 |
# File 'lib/lit/utils.rb', line 20 def [](key) key = key.is_a?(Symbol) ? key.to_s : key @values[key] end |
#each(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/lit/utils.rb', line 25 def each(&block) @values.each(&block) end |
#to_h ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/lit/utils.rb', line 29 def to_h @values end |