Sha256: dde7ca9a77854a8dd1083ff3c931a672e3148fcbbae9eca6c66e7851d5d2bbe8

Contents?: true

Size: 426 Bytes

Versions: 3

Compression:

Stored size: 426 Bytes

Contents

module Ohm

  # Represents a key in Redis.
  class Key < String
    Volatile = new("~")

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

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

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

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

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ohm-0.1.0.rc4 lib/ohm/key.rb
ohm-0.1.0.rc2 lib/ohm/key.rb
ohm-0.1.0.rc1 lib/ohm/key.rb