Class: FDB::Subspace
- Inherits:
-
Object
- Object
- FDB::Subspace
- Defined in:
- lib/fdbsubspace.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#raw_prefix ⇒ Object
readonly
Returns the value of attribute raw_prefix.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #as_foundationdb_key ⇒ Object
- #contains?(key) ⇒ Boolean
-
#initialize(prefix_tuple = [], raw_prefix = '') ⇒ Subspace
constructor
A new instance of Subspace.
- #key ⇒ Object
- #pack(tuple) ⇒ Object
- #range(tuple = []) ⇒ Object
- #subspace(tuple) ⇒ Object
- #unpack(key) ⇒ Object
Constructor Details
Instance Attribute Details
#raw_prefix ⇒ Object (readonly)
Returns the value of attribute raw_prefix.
35 36 37 |
# File 'lib/fdbsubspace.rb', line 35 def raw_prefix @raw_prefix end |
Instance Method Details
#[](name) ⇒ Object
37 38 39 |
# File 'lib/fdbsubspace.rb', line 37 def [](name) Subspace.new([name], @raw_prefix) end |
#as_foundationdb_key ⇒ Object
63 64 65 |
# File 'lib/fdbsubspace.rb', line 63 def as_foundationdb_key key end |
#contains?(key) ⇒ Boolean
59 60 61 |
# File 'lib/fdbsubspace.rb', line 59 def contains?(key) key.start_with? @raw_prefix end |
#key ⇒ Object
41 42 43 |
# File 'lib/fdbsubspace.rb', line 41 def key @raw_prefix end |
#pack(tuple) ⇒ Object
45 46 47 |
# File 'lib/fdbsubspace.rb', line 45 def pack(tuple) @raw_prefix + FDB::Tuple.pack(tuple) end |
#range(tuple = []) ⇒ Object
54 55 56 57 |
# File 'lib/fdbsubspace.rb', line 54 def range(tuple=[]) rng = FDB::Tuple.range(tuple) [@raw_prefix + rng[0], @raw_prefix + rng[1]] end |