Class: Berkshelf::PathLocation
- Inherits:
-
Object
- Object
- Berkshelf::PathLocation
- Includes:
- Location
- Defined in:
- lib/berkshelf/locations/path_location.rb
Overview
Constant Summary
Constants included from Location
Location::OPSCODE_COMMUNITY_API
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Attributes included from Location
Instance Method Summary collapse
- #download(destination) ⇒ Berkshelf::CachedCookbook
-
#initialize(name, version_constraint, options = {}) ⇒ PathLocation
constructor
A new instance of PathLocation.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Methods included from Location
#downloaded?, included, init, #to_json, #validate_cached
Constructor Details
#initialize(name, version_constraint, options = {}) ⇒ PathLocation
Returns a new instance of PathLocation.
16 17 18 19 20 21 |
# File 'lib/berkshelf/locations/path_location.rb', line 16 def initialize(name, version_constraint, = {}) @name = name @version_constraint = version_constraint @path = File.([:path]) set_downloaded_status(true) end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/berkshelf/locations/path_location.rb', line 8 def path @path end |
Instance Method Details
#download(destination) ⇒ Berkshelf::CachedCookbook
26 27 28 29 30 31 32 |
# File 'lib/berkshelf/locations/path_location.rb', line 26 def download(destination) cached = CachedCookbook.from_path(path) validate_cached(cached) set_downloaded_status(true) cached end |
#to_hash ⇒ Object
34 35 36 |
# File 'lib/berkshelf/locations/path_location.rb', line 34 def to_hash super.merge(value: self.path) end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/berkshelf/locations/path_location.rb', line 38 def to_s "#{self.class.location_key}: '#{path}'" end |