Method: NsOptions::NamespaceData#to_hash
- Defined in:
- lib/ns-options/namespace_data.rb
#to_hash ⇒ Object
recursively build a hash representation of the namespace, using symbols for the option/namespace name-keys
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ns-options/namespace_data.rb', line 48 def to_hash Hash.new.tap do |hash| .each do |name, opt| # this is meant to be a "value exporter", so always use distinct values # on the returned hash to prevent unintentional pass-by-ref shared objects hash[name.to_sym] = NsOptions.distinct_value(opt.value) end @child_namespaces.each{|name, value| hash[name.to_sym] = value.to_hash} end end |