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', __dir__)
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
7 8 9 |
# File 'lib/dpl/helper/assets.rb', line 7 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace
7 8 9 |
# File 'lib/dpl/helper/assets.rb', line 7 def namespace @namespace end |
#provider ⇒ Object
Returns the value of attribute provider
7 8 9 |
# File 'lib/dpl/helper/assets.rb', line 7 def provider @provider end |
Instance Method Details
#copy(target) ⇒ Object
12 13 14 |
# File 'lib/dpl/helper/assets.rb', line 12 def copy(target) cp path, File.(target) end |
#exists? ⇒ Boolean
20 21 22 |
# File 'lib/dpl/helper/assets.rb', line 20 def exists? File.exist?(path) end |
#path ⇒ Object
28 29 30 |
# File 'lib/dpl/helper/assets.rb', line 28 def path "#{DIR}/#{namespace}/#{name}" end |
#read ⇒ Object
16 17 18 |
# File 'lib/dpl/helper/assets.rb', line 16 def read exists? ? provider.interpolate(File.read(path)) : unknown end |
#unknown ⇒ Object
24 25 26 |
# File 'lib/dpl/helper/assets.rb', line 24 def unknown raise "Could not find asset #{path}" end |