Class: AppManifest::Manifest
- Inherits:
-
Object
- Object
- AppManifest::Manifest
- Includes:
- EnvironmentAttributes, Serializer
- Defined in:
- lib/app_manifest/manifest.rb
Overview
A simple model-like wrapper around a manifest hash.
Class Method Summary collapse
Instance Method Summary collapse
- #environment(name) ⇒ Object
- #environments? ⇒ Boolean
-
#initialize(hash) ⇒ Manifest
constructor
A new instance of Manifest.
Methods included from Serializer
Methods included from EnvironmentAttributes
Constructor Details
#initialize(hash) ⇒ Manifest
Returns a new instance of Manifest.
15 16 17 18 |
# File 'lib/app_manifest/manifest.rb', line 15 def initialize(hash) canonicalized = AppManifest.canonicalize(hash) super(canonicalized) end |
Class Method Details
.from_json(string) ⇒ Object
10 11 12 13 |
# File 'lib/app_manifest/manifest.rb', line 10 def self.from_json(string) hash = MultiJson.load(string) new(hash) end |
Instance Method Details
#environment(name) ⇒ Object
20 21 22 23 24 |
# File 'lib/app_manifest/manifest.rb', line 20 def environment(name) scoped_data = (environments || {}).fetch(name.to_s, {}).to_hash global_data = to_hash Environment.new(global_data.merge(scoped_data)) end |
#environments? ⇒ Boolean
26 27 28 |
# File 'lib/app_manifest/manifest.rb', line 26 def environments? !environments.nil? end |