Class: Async::Redis::Key

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/async/redis/key.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#pathObject (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

#sizeObject



19
20
21
# File 'lib/async/redis/key.rb', line 19

def size
	@path.bytesize
end

#to_sObject



25
26
27
# File 'lib/async/redis/key.rb', line 25

def to_s
	@path
end

#to_strObject



29
30
31
# File 'lib/async/redis/key.rb', line 29

def to_str
	@path
end