Class: Middleman::Imageoptim::Manifest
- Inherits:
-
Object
- Object
- Middleman::Imageoptim::Manifest
- Defined in:
- lib/middleman-imageoptim/manifest.rb
Constant Summary collapse
- MANIFEST_FILENAME =
'imageoptim.manifest.yml'.freeze
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #build_and_write(new_resources) ⇒ Object
- #build_dir ⇒ Object
-
#initialize(app) ⇒ Manifest
constructor
A new instance of Manifest.
- #path ⇒ Object
- #resource(key) ⇒ Object
Constructor Details
#initialize(app) ⇒ Manifest
Returns a new instance of Manifest.
8 9 10 |
# File 'lib/middleman-imageoptim/manifest.rb', line 8 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
6 7 8 |
# File 'lib/middleman-imageoptim/manifest.rb', line 6 def app @app end |
Instance Method Details
#build_and_write(new_resources) ⇒ Object
24 25 26 |
# File 'lib/middleman-imageoptim/manifest.rb', line 24 def build_and_write(new_resources) write(dump(build(new_resources))) end |
#build_dir ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/middleman-imageoptim/manifest.rb', line 16 def build_dir if Gem::Version.new(Middleman::VERSION) >= Gem::Version.new('4.0.0') app.config[:build_dir] else app.build_dir end end |
#path ⇒ Object
12 13 14 |
# File 'lib/middleman-imageoptim/manifest.rb', line 12 def path File.join(build_dir, MANIFEST_FILENAME) end |
#resource(key) ⇒ Object
28 29 30 |
# File 'lib/middleman-imageoptim/manifest.rb', line 28 def resource(key) resources[key.to_s] end |