Async::RedisSourceAsyncRedisKey

class Key

Represents a Redis key with utility methods for key manipulation.

Definitions

def self.[] path

Create a new Key instance.

Signature

parameter path String

The key path.

returns Key

A new Key instance.

Implementation

def self.[] path
	self.new(path)
end

def [] key

Create a child key by appending a subkey.

Signature

parameter key String

The subkey to append.

returns Key

A new Key with the appended subkey.

Implementation

def [] key
	self.class.new("#{@path}:#{key}")
end

def initialize(path)

Initialize a new Key.

Signature

parameter path String

The key path.

Implementation

def initialize(path)
	@path = path
end

def size

Get the byte size of the key.

Signature

returns Integer

The byte size of the key path.

Implementation

def size
	@path.bytesize
end

def to_s

Convert the key to a string.

Signature

returns String

The key path as a string.

Implementation

def to_s
	@path
end

def to_str

Convert the key to a string (for String compatibility).

Signature

returns String

The key path as a string.

Implementation

def to_str
	@path
end

def <=> other

Compare this key with another key.

Signature

parameter other Key

The other key to compare with.

returns Integer

-1, 0, or 1 for comparison result.

Implementation

def <=> other
	@path <=> other.to_str
end