Class: Packagecloud::Package
- Inherits:
-
Object
- Object
- Packagecloud::Package
- Defined in:
- lib/packagecloud/package.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#source_files ⇒ Object
Returns the value of attribute source_files.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Package
constructor
A new instance of Package.
Constructor Details
#initialize(options = {}) ⇒ Package
Returns a new instance of Package.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/packagecloud/package.rb', line 9 def initialize( = {}) if [:file].nil? raise ArgumentError, 'file cannot be nil' if file.nil? end if [:file].is_a? String [:file] = File.open([:file]) end if [:file].is_a? File [:filename] = File.basename([:file].path) end if [:filename].nil? raise ArgumentError, 'filename cannot be nil' if file.nil? end @file = [:file] @filename = [:filename] @source_files = [:source_files] || {} @client = [:client] end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/packagecloud/package.rb', line 7 def client @client end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
4 5 6 |
# File 'lib/packagecloud/package.rb', line 4 def file @file end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
6 7 8 |
# File 'lib/packagecloud/package.rb', line 6 def filename @filename end |
#source_files ⇒ Object
Returns the value of attribute source_files.
5 6 7 |
# File 'lib/packagecloud/package.rb', line 5 def source_files @source_files end |