Sha256: d2840bdc3d2d31a63a7e3eeab694a9c975dea90414407a8963d8343cbf991134

Contents?: true

Size: 518 Bytes

Versions: 5

Compression:

Stored size: 518 Bytes

Contents

module AppManifest
  # A simple model-like wrapper around a manifest hash.
  class Manifest
    def self.from_json(string)
      hash = MultiJson.load(string)
      self.new(hash)
    end

    def initialize(hash)
      @manifest = AppManifest.canonicalize(hash)
    end

    def environment(name)
      env_manifest = manifest.fetch(:environments, {}).fetch(name, {})
      self.class.new(manifest.merge(env_manifest))
    end

    def to_hash
      manifest
    end

    private

    attr_reader :manifest
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
app_manifest-0.2.1 lib/app_manifest/manifest.rb
app_manifest-0.2.0 lib/app_manifest/manifest.rb
app_manifest-0.1.2 lib/app_manifest/manifest.rb
app_manifest-0.1.1 lib/app_manifest/manifest.rb
app_manifest-0.1.0 lib/app_manifest/manifest.rb