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.
15 16 17 |
# File 'lib/async/redis/key.rb', line 15 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
23 24 25 |
# File 'lib/async/redis/key.rb', line 23 def path @path end |
Class Method Details
.[](path) ⇒ Object
9 10 11 |
# File 'lib/async/redis/key.rb', line 9 def self.[] path self.new(path) end |
Instance Method Details
#<=>(other) ⇒ Object
37 38 39 |
# File 'lib/async/redis/key.rb', line 37 def <=> other @path <=> other.to_str end |
#[](key) ⇒ Object
33 34 35 |
# File 'lib/async/redis/key.rb', line 33 def [] key self.class.new("#{@path}:#{key}") end |
#size ⇒ Object
19 20 21 |
# File 'lib/async/redis/key.rb', line 19 def size @path.bytesize end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/async/redis/key.rb', line 25 def to_s @path end |
#to_str ⇒ Object
29 30 31 |
# File 'lib/async/redis/key.rb', line 29 def to_str @path end |