Class: Configature::Data

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/configature/data.rb

Direct Known Subclasses

Config

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.hashify(data) ⇒ Object

Class Methods ========================================================



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/configature/data.rb', line 6

def self.hashify(data)
  case (data)
  when Configature::Data
    data.to_h
  when Array
    data.map do |v|
      hashify(v)
    end
  else
    data
  end
end

Instance Method Details

#to_hObject

Instance Methods =====================================================



21
22
23
24
25
# File 'lib/configature/data.rb', line 21

def to_h
  super.map do |k, v|
    [ k, self.class.hashify(v) ]
  end.to_h
end