Class: LevelDB::DB
Instance Attribute Summary collapse
-
#pathname ⇒ Object
readonly
Returns the value of attribute pathname.
Class Method Summary collapse
-
.create(pathname) ⇒ Object
Creates a new LevelDB database stored on disk at
pathname
. -
.load(pathname) ⇒ Object
Loads a LevelDB database stored on disk at
pathname
. -
.new(pathname) ⇒ Object
Loads or creates a LevelDB database as necessary, stored on disk at
pathname
.
Instance Method Summary collapse
- #each(*args, &block) ⇒ Object
- #inspect ⇒ Object
- #iterator(*args) ⇒ Object
- #keys ⇒ Object
- #values ⇒ Object
Instance Attribute Details
#pathname ⇒ Object (readonly)
Returns the value of attribute pathname.
33 34 35 |
# File 'lib/leveldb.rb', line 33 def pathname @pathname end |
Class Method Details
.create(pathname) ⇒ Object
Creates a new LevelDB database stored on disk at pathname
. Throws an exception if the database already exists.
15 16 17 |
# File 'lib/leveldb.rb', line 15 def create pathname make path_string(pathname), true, true end |
.load(pathname) ⇒ Object
Loads a LevelDB database stored on disk at pathname
. Throws an exception unless the database already exists.
21 22 23 |
# File 'lib/leveldb.rb', line 21 def load pathname make path_string(pathname), false, false end |
.new(pathname) ⇒ Object
Loads or creates a LevelDB database as necessary, stored on disk at pathname
.
9 10 11 |
# File 'lib/leveldb.rb', line 9 def new pathname make path_string(pathname), true, false end |
Instance Method Details
#each(*args, &block) ⇒ Object
41 42 43 44 45 |
# File 'lib/leveldb.rb', line 41 def each(*args, &block) i = iterator(*args) i.each(&block) if block i end |
#inspect ⇒ Object
51 52 53 |
# File 'lib/leveldb.rb', line 51 def inspect %(<#{self.class} #{@pathname.inspect}>) end |
#iterator(*args) ⇒ Object
47 |
# File 'lib/leveldb.rb', line 47 def iterator(*args); Iterator.new self, *args end |
#keys ⇒ Object
48 |
# File 'lib/leveldb.rb', line 48 def keys; map { |k, v| k } end |
#values ⇒ Object
49 |
# File 'lib/leveldb.rb', line 49 def values; map { |k, v| v } end |