Class: Captain::Release::Component::Manifest
- Inherits:
-
Object
- Object
- Captain::Release::Component::Manifest
- Defined in:
- lib/captain/release.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #checksum(algorithm) ⇒ Object
- #copy_to(directory) ⇒ Object
-
#initialize(path, contents) ⇒ Manifest
constructor
A new instance of Manifest.
- #size ⇒ Object
Constructor Details
#initialize(path, contents) ⇒ Manifest
Returns a new instance of Manifest.
79 80 81 82 |
# File 'lib/captain/release.rb', line 79 def initialize(path, contents) @path = path @contents = contents end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
77 78 79 |
# File 'lib/captain/release.rb', line 77 def path @path end |
Instance Method Details
#checksum(algorithm) ⇒ Object
90 91 92 |
# File 'lib/captain/release.rb', line 90 def checksum(algorithm) Digest(algorithm).hexdigest(@contents) end |
#copy_to(directory) ⇒ Object
84 85 86 87 88 |
# File 'lib/captain/release.rb', line 84 def copy_to(directory) file = Pathname.new(directory).join(path) file.dirname.mkpath file.open('w') { |io| io.write(@contents) } end |
#size ⇒ Object
94 95 96 |
# File 'lib/captain/release.rb', line 94 def size @contents.length end |