Module: Petticoat

Defined in:
lib/petticoat.rb,
lib/petticoat/cli.rb,
lib/petticoat/schema.rb,
lib/petticoat/adapter.rb,
lib/petticoat/version.rb,
lib/petticoat/document.rb,
lib/petticoat/snapshot.rb,
lib/petticoat/installer.rb,
lib/petticoat/installation_path.rb

Defined Under Namespace

Modules: Schema Classes: Adapter, CLI, Document, Error, InstallationPath, Installer, Snapshot

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.canonical(value) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/petticoat.rb', line 11

def self.canonical(value)
  case value
  when Hash then value.keys.sort.to_h { |key| [key, canonical(value.fetch(key))] }
  when Array then value.map { |item| canonical(item) }
  else value
  end
end

.canonical_json(value) ⇒ Object



19
20
21
# File 'lib/petticoat.rb', line 19

def self.canonical_json(value)
  "#{JSON.pretty_generate(canonical(value))}\n"
end