Class: Mamiya::Storages::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/mamiya/storages/abstract.rb

Direct Known Subclasses

Filesystem, Mock, S3

Defined Under Namespace

Classes: AlreadyExists, AlreadyFetched, NotBuilt, NotFound

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Abstract

Returns a new instance of Abstract.



9
10
11
12
# File 'lib/mamiya/storages/abstract.rb', line 9

def initialize(config = {})
  @config = config.dup
  @application = config.delete(:application)
end

Instance Attribute Details

#applicationObject (readonly)

Returns the value of attribute application.



14
15
16
# File 'lib/mamiya/storages/abstract.rb', line 14

def application
  @application
end

#configObject (readonly)

Returns the value of attribute config.



14
15
16
# File 'lib/mamiya/storages/abstract.rb', line 14

def config
  @config
end

Class Method Details

.find(config = {}) ⇒ Object



16
17
18
# File 'lib/mamiya/storages/abstract.rb', line 16

def self.find(config={})
  {}
end

Instance Method Details

#fetch(package_name, dir) ⇒ Object

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/mamiya/storages/abstract.rb', line 28

def fetch(package_name, dir)
  raise NotImplementedError
end

#meta(package_name) ⇒ Object

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/mamiya/storages/abstract.rb', line 32

def meta(package_name)
  raise NotImplementedError
end

#packagesObject



20
21
22
# File 'lib/mamiya/storages/abstract.rb', line 20

def packages
  []
end

#prune(nums_to_keep) ⇒ Object



40
41
42
43
44
45
# File 'lib/mamiya/storages/abstract.rb', line 40

def prune(nums_to_keep)
  packages = self.packages()
  packages[0...-nums_to_keep].each do |package|
    self.remove(package)
  end
end

#push(package) ⇒ Object

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/mamiya/storages/abstract.rb', line 24

def push(package)
  raise NotImplementedError
end

#remove(package) ⇒ Object

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/mamiya/storages/abstract.rb', line 36

def remove(package)
  raise NotImplementedError
end