Class: BioLocus::MonetaMapper
- Inherits:
-
Object
- Object
- BioLocus::MonetaMapper
- Defined in:
- lib/bio-locus/dbmapper.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #close ⇒ Object
-
#initialize(storage, dbname) ⇒ MonetaMapper
constructor
A new instance of MonetaMapper.
Constructor Details
#initialize(storage, dbname) ⇒ MonetaMapper
Returns a new instance of MonetaMapper.
26 27 28 29 30 31 32 33 34 |
# File 'lib/bio-locus/dbmapper.rb', line 26 def initialize storage, dbname begin require 'moneta' rescue LoadError $stderr.print "Error: Missing moneta. Install with command 'gem install moneta'\n" exit 1 end @store = Moneta.new(storage, file: dbname) end |
Instance Method Details
#[](key) ⇒ Object
36 37 38 |
# File 'lib/bio-locus/dbmapper.rb', line 36 def [] key @store[key] end |
#[]=(key, value) ⇒ Object
40 41 42 |
# File 'lib/bio-locus/dbmapper.rb', line 40 def []= key, value @store[key] = value end |
#close ⇒ Object
44 45 46 |
# File 'lib/bio-locus/dbmapper.rb', line 44 def close @store.close end |