Class: RemoteTable::Package

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bus) ⇒ Package

Returns a new instance of Package.



5
6
7
8
9
10
11
# File 'lib/remote_table/package.rb', line 5

def initialize(bus)
  @url = bus[:url] or raise "need url"
  @compression = bus[:compression] || compression_from_basename
  @packing = bus[:packing] || packing_from_basename_and_compression
  @filename = bus[:filename] || filename_from_basename_and_compression_and_packing
  add_hints!(bus)
end

Instance Attribute Details

#compressionObject

Returns the value of attribute compression.



3
4
5
# File 'lib/remote_table/package.rb', line 3

def compression
  @compression
end

#filenameObject

Returns the value of attribute filename.



3
4
5
# File 'lib/remote_table/package.rb', line 3

def filename
  @filename
end

#packingObject

Returns the value of attribute packing.



3
4
5
# File 'lib/remote_table/package.rb', line 3

def packing
  @packing
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/remote_table/package.rb', line 3

def url
  @url
end

Instance Method Details

#add_hints!(hash) ⇒ Object



13
14
15
# File 'lib/remote_table/package.rb', line 13

def add_hints!(hash)
  hash[:filename] = filename unless hash.has_key?(:filename)
end

#stage(path) ⇒ Object



17
18
19
20
21
22
# File 'lib/remote_table/package.rb', line 17

def stage(path)
  decompress(path)
  unpack(path)
  identify(path)
  file_path(path)
end