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.



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

def initialize(path)
	@path = path
end

Instance Attribute Details

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

#sizeObject



34
35
36
# File 'lib/async/redis/key.rb', line 34

def size
	@path.bytesize
end

#to_sObject



40
41
42
# File 'lib/async/redis/key.rb', line 40

def to_s
	@path
end

#to_strObject



44
45
46
# File 'lib/async/redis/key.rb', line 44

def to_str
	@path
end