Class: RocksDB::DB
- Inherits:
-
Object
- Object
- RocksDB::DB
- Extended by:
- Forwardable, Gem::Deprecate
- Defined in:
- lib/rocksdb.rb,
lib/rocksdb/ruby/deprecated.rb
Instance Method Summary collapse
- #get(*args) ⇒ Object (also: #[])
-
#initialize(path, rocksdb_options = "", options = {}) ⇒ DB
constructor
A new instance of DB.
- #is_readonly? ⇒ Boolean
- #options ⇒ Object
Constructor Details
#initialize(path, rocksdb_options = "", options = {}) ⇒ DB
Returns a new instance of DB.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rocksdb.rb', line 30 def initialize(path, = "", = {}) is_readonly = [:readonly] || false if .is_a? Hash = .map do |key, value| [key, value].join("=") end.join(";") end __initialize(path, is_readonly, .to_s) end |
Instance Method Details
#get(*args) ⇒ Object Also known as: []
42 43 44 45 46 47 48 49 50 |
# File 'lib/rocksdb.rb', line 42 def get(*args) args.flatten! if args.size == 1 get_one args.first else get_many args end end |
#is_readonly? ⇒ Boolean
18 19 20 |
# File 'lib/rocksdb/ruby/deprecated.rb', line 18 def is_readonly? !writable? end |
#options ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/rocksdb.rb', line 52 def .each_with_object({}) do |(option_group, value), result| pairs = value.split(/;\s*/) pairs.map do |pair| key, value = pair.split("=") result[key] = value end end end |