Class: Dpl::Assets::Asset
- Inherits:
-
Struct
- Object
- Struct
- Dpl::Assets::Asset
- Includes:
- FileUtils
- Defined in:
- lib/dpl/helper/assets.rb
Constant Summary collapse
- DIR =
File.('../../assets', __FILE__)
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#provider ⇒ Object
Returns the value of attribute provider.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
5 6 7 |
# File 'lib/dpl/helper/assets.rb', line 5 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace
5 6 7 |
# File 'lib/dpl/helper/assets.rb', line 5 def namespace @namespace end |
#provider ⇒ Object
Returns the value of attribute provider
5 6 7 |
# File 'lib/dpl/helper/assets.rb', line 5 def provider @provider end |
Instance Method Details
#copy(target) ⇒ Object
10 11 12 |
# File 'lib/dpl/helper/assets.rb', line 10 def copy(target) cp path, File.(target) end |
#exists? ⇒ Boolean
18 19 20 |
# File 'lib/dpl/helper/assets.rb', line 18 def exists? File.exists?(path) end |
#path ⇒ Object
26 27 28 |
# File 'lib/dpl/helper/assets.rb', line 26 def path "#{DIR}/#{namespace}/#{name}" end |
#read ⇒ Object
14 15 16 |
# File 'lib/dpl/helper/assets.rb', line 14 def read exists? ? provider.interpolate(File.read(path)) : unknown end |
#unknown ⇒ Object
22 23 24 |
# File 'lib/dpl/helper/assets.rb', line 22 def unknown raise "Could not find asset #{path}" end |