Class: Bits::LocalBackend

Inherits:
Backend
  • Object
show all
Includes:
Logging
Defined in:
lib/bits/backend/local.rb

Instance Method Summary collapse

Methods included from Logging

included, #log

Constructor Details

#initialize(path, ext = 'yml') ⇒ LocalBackend

Returns a new instance of LocalBackend.



11
12
13
14
# File 'lib/bits/backend/local.rb', line 11

def initialize(path, ext='yml')
  @path = path
  @ext = ext
end

Instance Method Details

#fetch(atom) ⇒ Object

no need to fetch



17
18
19
20
21
22
# File 'lib/bits/backend/local.rb', line 17

def fetch(atom)
  path = File.join @path, "#{atom}.#{@ext}"
  raise MissingBit.new atom unless File.file? path
  log.debug "bit from local path: #{path}"
  BitReaderLocal.new path
end