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.



32
33
34
# File 'lib/async/redis/key.rb', line 32

def initialize(path)
	@path = path
end

Instance Attribute Details

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

#sizeObject



36
37
38
# File 'lib/async/redis/key.rb', line 36

def size
	@path.bytesize
end

#to_sObject



42
43
44
# File 'lib/async/redis/key.rb', line 42

def to_s
	@path
end

#to_strObject



46
47
48
# File 'lib/async/redis/key.rb', line 46

def to_str
	@path
end