Class: ConfigMapper::DictMapper

Inherits:
Mapper
  • Object
show all
Defined in:
lib/config_mapper/dict_mapper.rb

Overview

Configuration proxy for a Hash.

Instance Method Summary collapse

Methods inherited from Mapper

#configure_with

Constructor Details

#initialize(hash) ⇒ DictMapper

Returns a new instance of DictMapper.



9
10
11
# File 'lib/config_mapper/dict_mapper.rb', line 9

def initialize(hash)
  @hash = hash
end

Instance Method Details

#get(key) ⇒ Object



17
18
19
# File 'lib/config_mapper/dict_mapper.rb', line 17

def get(key)
  @hash[key]
end

#path(key) ⇒ Object



13
14
15
# File 'lib/config_mapper/dict_mapper.rb', line 13

def path(key)
  "[#{key.inspect}]"
end

#set(key, value) ⇒ Object



21
22
23
# File 'lib/config_mapper/dict_mapper.rb', line 21

def set(key, value)
  @hash[key] = value
end