class Packagecloud::Package

Attributes

client[R]
file[R]
filename[R]
source_files[RW]

Public Class Methods

new(options = {}) click to toggle source
# 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