Class: ConfigKit::SlashedHash
- Inherits:
-
Hash
- Object
- Hash
- ConfigKit::SlashedHash
show all
- Defined in:
- lib/config_kit/ext/slashed_hash.rb
Defined Under Namespace
Classes: SlashedHashTypeError
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Hash
#deep_merge
Constructor Details
#initialize(hash, keep_nesting = false) ⇒ SlashedHash
Returns a new instance of SlashedHash.
4
5
6
7
8
9
|
# File 'lib/config_kit/ext/slashed_hash.rb', line 4
def initialize(hash, keep_nesting=false)
self.merge!(hash) if keep_nesting
self.merge!(dot_flattened(hash))
SlashedHash.symbolize(self)
end
|
Class Method Details
.symbolize(hash) ⇒ Object
19
20
21
22
23
|
# File 'lib/config_kit/ext/slashed_hash.rb', line 19
def self.symbolize(hash)
hash.keys.each do |key|
hash[key.to_sym] = hash.delete(key)
end
end
|
Instance Method Details
#inspect ⇒ Object
11
12
13
|
# File 'lib/config_kit/ext/slashed_hash.rb', line 11
def inspect
"#<#{self.class.name}:#{object_id} #{super}>"
end
|
#to_hash ⇒ Object
15
16
17
|
# File 'lib/config_kit/ext/slashed_hash.rb', line 15
def to_hash
{}.replace(self)
end
|