Class: Ohm::Key

Inherits:
String show all
Defined in:
lib/ohm/key.rb

Overview

Represents a key in Redis.

Constant Summary

Volatile =
new("~")

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from String

#lines

Class Method Details

+ (Object) [](*args)



7
8
9
# File 'lib/ohm/key.rb', line 7

def self.[](*args)
  new(args.join(":"))
end

Instance Method Details

- (Object) +(other)



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

def +(other)
  self.class.new("#{self}+#{other}")
end

- (Object) -(other)



23
24
25
# File 'lib/ohm/key.rb', line 23

def -(other)
  self.class.new("#{self}-#{other}")
end

- (Object) [](key)



11
12
13
# File 'lib/ohm/key.rb', line 11

def [](key)
  self.class[self, key]
end

- (Object) volatile



15
16
17
# File 'lib/ohm/key.rb', line 15

def volatile
  self.index(Volatile) == 0 ? self : Volatile[self]
end