Class: Archipelago::Cove::Tanker

Inherits:
Object
  • Object
show all
Includes:
Disco::Publishable
Defined in:
lib/archipelago/cove.rb

Instance Method Summary collapse

Methods included from Disco::Publishable

#_dump, append_features, #initialize_publishable, #publish!, #service_id, #stop!, #valid?

Constructor Details

#initialize(options = {}) ⇒ Tanker

Returns a new instance of Tanker.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/archipelago/cove.rb', line 34

def initialize(options = {})
  #
  # The provider of happy magic persistent hashes of different kinds.
  #
  @persistence_provider = options[:persistence_provider] || Archipelago::Hashish::BerkeleyHashishProvider.new(Pathname.new(File.expand_path(__FILE__)).parent.join("cove_tanker.db"))

  @db = @persistence_provider.get_hashish("db")

  @valdez = options[:valdez] || Archipelago::Exxon::HAZELWOOD

  #
  # Use the given options to initialize the publishable
  # instance variables.
  #
  initialize_publishable(options)

end

Instance Method Details

#get_part(key) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/archipelago/cove.rb', line 56

def get_part(key)
  if @db.include?(key)
    return Marshal.load(@db[key])
  else
    return nil
  end
end

#store_part(key, split_part) ⇒ Object



52
53
54
# File 'lib/archipelago/cove.rb', line 52

def store_part(key, split_part)
  @db[key] = Marshal.dump(split_part)
end