Class: Database::Backends
- Inherits:
-
Object
- Object
- Database::Backends
- Extended by:
- Forwardable
- Defined in:
- lib/database/backends.rb
Instance Method Summary collapse
- #has?(oid) ⇒ Boolean
-
#initialize(pathname) ⇒ Backends
constructor
A new instance of Backends.
- #load_info(oid) ⇒ Object
- #load_raw(oid) ⇒ Object
- #pack_path ⇒ Object
- #prefix_match(name) ⇒ Object
- #reload ⇒ Object
Constructor Details
Instance Method Details
#has?(oid) ⇒ Boolean
27 28 29 |
# File 'lib/database/backends.rb', line 27 def has?(oid) @stores.any? { |store| store.has?(oid) } end |
#load_info(oid) ⇒ Object
31 32 33 |
# File 'lib/database/backends.rb', line 31 def load_info(oid) @stores.reduce(nil) { |info, store| info || store.load_info(oid) } end |
#load_raw(oid) ⇒ Object
35 36 37 |
# File 'lib/database/backends.rb', line 35 def load_raw(oid) @stores.reduce(nil) { |raw, store| raw || store.load_raw(oid) } end |
#pack_path ⇒ Object
23 24 25 |
# File 'lib/database/backends.rb', line 23 def pack_path @pathname.join("pack") end |
#prefix_match(name) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/database/backends.rb', line 39 def prefix_match(name) oids = @stores.reduce([]) do |list, store| list + store.prefix_match(name) end oids.uniq end |
#reload ⇒ Object
19 20 21 |
# File 'lib/database/backends.rb', line 19 def reload @stores = [@loose] + packed end |