Class: Async::Redis::Key
- Inherits:
-
Object
- Object
- Async::Redis::Key
- Includes:
- Comparable
- Defined in:
- lib/async/redis/key.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #[](key) ⇒ Object
-
#initialize(path) ⇒ Key
constructor
A new instance of Key.
- #size ⇒ Object
- #to_s ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(path) ⇒ Key
Returns a new instance of Key.
32 33 34 |
# File 'lib/async/redis/key.rb', line 32 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
40 41 42 |
# File 'lib/async/redis/key.rb', line 40 def path @path end |
Class Method Details
.[](path) ⇒ Object
26 27 28 |
# File 'lib/async/redis/key.rb', line 26 def self.[] path self.new(path) end |
Instance Method Details
#<=>(other) ⇒ Object
54 55 56 |
# File 'lib/async/redis/key.rb', line 54 def <=> other @path <=> other.to_str end |
#[](key) ⇒ Object
50 51 52 |
# File 'lib/async/redis/key.rb', line 50 def [] key self.class.new("#{@path}:#{key}") end |
#size ⇒ Object
36 37 38 |
# File 'lib/async/redis/key.rb', line 36 def size @path.bytesize end |
#to_s ⇒ Object
42 43 44 |
# File 'lib/async/redis/key.rb', line 42 def to_s @path end |
#to_str ⇒ Object
46 47 48 |
# File 'lib/async/redis/key.rb', line 46 def to_str @path end |