Class: App::Configurator::Struct

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/config/app.rb

Overview

OpenStruct class adaptation

Instance Method Summary collapse

Instance Method Details

#to_hashObject

convert struct to hash, taken from: github.com/rubyconfig/config



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/config/app.rb', line 24

def to_hash
  result = {}
  marshal_dump.each do |k, v|
    if v.instance_of? Configurator::Struct
      result[k] = v.to_hash
    elsif v.instance_of? Array
      result[k] = descend_array(v)
    else
      result[k] = v
    end
  end
  result
end