lib/cockpit/core/definition.rb
def flatten(separator = ".")
        unless @flattened
          if nested?
            @flattened = value.inject({key => self}) do |hash, definition|
              sub_definition = definition.keys.inject({}) do |sub_hash, sub_key|
                sub_hash["#{key}#{separator}#{sub_key}"] = definition.child(sub_key)
                sub_hash
              end
              hash.merge(sub_definition)
            end
          else
            @flattened = {key => self}
          end
        end
        
        @flattened
      end
# map of nested key to definition
map of nested key to definition
map of nested key to definition
def flatten(separator = ".")
        unless @flattened
          if nested?
            @flattened = value.inject({key => self}) do |hash, definition|
              sub_definition = definition.keys.inject({}) do |sub_hash, sub_key|
                sub_hash["#{key}#{separator}#{sub_key}"] = definition.child(sub_key)
                sub_hash
              end
              hash.merge(sub_definition)
            end
          else
            @flattened = {key => self}
          end
        end
        @flattened
      end
def flatten ( separator = "." ) unless @flattened if nested? @flattened = value . inject ( { key => self } ) do | hash , definition | sub_definition = definition . keys . inject ( { } ) do | sub_hash , sub_key | sub_hash [ "#{key}#{separator}#{sub_key}" ] = definition . child ( sub_key ) sub_hash end hash . merge ( sub_definition ) end else @flattened = { key => self } end end @flattened end
map of nested key to definition
map of nested key to definition
separator