Class: Packagecloud::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/packagecloud/package.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  if options[:file].nil?
    raise ArgumentError, 'file cannot be nil' if file.nil?
  end
  if options[:file].is_a? String
    options[:file] = File.open(options[:file])
  end
  if options[:file].is_a? File
    options[:filename] = File.basename(options[:file].path)
  end
  if options[:filename].nil?
    raise ArgumentError, 'filename cannot be nil' if file.nil?
  end

  @file = options[:file]
  @filename = options[:filename]
  @source_files = options[:source_files] || {}
  @client = options[:client]
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/packagecloud/package.rb', line 7

def client
  @client
end

#fileObject (readonly)

Returns the value of attribute file.



4
5
6
# File 'lib/packagecloud/package.rb', line 4

def file
  @file
end

#filenameObject (readonly)

Returns the value of attribute filename.



6
7
8
# File 'lib/packagecloud/package.rb', line 6

def filename
  @filename
end

#source_filesObject

Returns the value of attribute source_files.



5
6
7
# File 'lib/packagecloud/package.rb', line 5

def source_files
  @source_files
end