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.
30 31 32 |
# File 'lib/async/redis/key.rb', line 30 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
38 39 40 |
# File 'lib/async/redis/key.rb', line 38 def path @path end |
Class Method Details
.[](path) ⇒ Object
24 25 26 |
# File 'lib/async/redis/key.rb', line 24 def self.[] path self.new(path) end |
Instance Method Details
#<=>(other) ⇒ Object
52 53 54 |
# File 'lib/async/redis/key.rb', line 52 def <=> other @path <=> other.to_str end |
#[](key) ⇒ Object
48 49 50 |
# File 'lib/async/redis/key.rb', line 48 def [] key self.class.new("#{@path}:#{key}") end |
#size ⇒ Object
34 35 36 |
# File 'lib/async/redis/key.rb', line 34 def size @path.bytesize end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/async/redis/key.rb', line 40 def to_s @path end |
#to_str ⇒ Object
44 45 46 |
# File 'lib/async/redis/key.rb', line 44 def to_str @path end |