Class: LIT::Utils::MapHash Private

Inherits:
Object
  • Object
show all
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.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Since:

  • 0.1.0



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

#valuesObject (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.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



25
26
27
# File 'lib/lit/utils.rb', line 25

def each(&block)
  @values.each(&block)
end

#to_hObject

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.

Since:

  • 0.1.0



29
30
31
# File 'lib/lit/utils.rb', line 29

def to_h
  @values
end