Class: Bits::JoinBackend

Inherits:
Backend show all
Includes:
Logging
Defined in:
lib/bits/backend/join.rb

Instance Method Summary collapse

Methods included from Logging

included, #log

Constructor Details

#initialize(backends) ⇒ JoinBackend

Returns a new instance of JoinBackend.



9
10
11
# File 'lib/bits/backend/join.rb', line 9

def initialize(backends)
  @backends = backends
end

Instance Method Details

#fetch(atom) ⇒ Object

no need to fetch



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bits/backend/join.rb', line 14

def fetch(atom)
  @backends.each do |backend|
    begin
      return backend.fetch atom
    rescue MissingBit
      next
    end
  end

  raise MissingBit.new atom
end