Class: Repository::StashStorage

Inherits:
Storage
  • Object
show all
Defined in:
lib/repository/stash_storage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Storage

#[], #find, for_class, #get

Constructor Details

#initialize(klass, stash = Stash.new) ⇒ StashStorage

Returns a new instance of StashStorage.



6
7
8
9
10
11
# File 'lib/repository/stash_storage.rb', line 6

def initialize(klass, stash = Stash.new)
  raise "nope" if klass.is_a? Stash
  raise "nuh-uh" unless stash.is_a? Stash
  super(klass)
  @stash = stash
end

Instance Attribute Details

#stashObject (readonly)

Returns the value of attribute stash.



4
5
6
# File 'lib/repository/stash_storage.rb', line 4

def stash
  @stash
end

Instance Method Details

#clearObject



17
18
19
# File 'lib/repository/stash_storage.rb', line 17

def clear
  @stash.clear
end

#find_by_criterion(criterion) ⇒ Object



25
26
27
# File 'lib/repository/stash_storage.rb', line 25

def find_by_criterion(criterion)
  @stash.find(criterion)
end

#find_by_keys(keys) ⇒ Object



29
30
31
# File 'lib/repository/stash_storage.rb', line 29

def find_by_keys(keys)
  @stash.find(keys)
end

#sizeObject



13
14
15
# File 'lib/repository/stash_storage.rb', line 13

def size
  @stash.size
end

#store(objects) ⇒ Object



21
22
23
# File 'lib/repository/stash_storage.rb', line 21

def store(objects)
  @stash.put(objects)
end