Sha256: 2ea859a89464eb1bc6858dc4acc28a18c5e0d0c74cb656ee624a65d4db69b15b
Contents?: true
Size: 686 Bytes
Versions: 5
Compression:
Stored size: 686 Bytes
Contents
module Redistat class Label include Database attr_reader :raw attr_reader :connection_ref def initialize(str, options = {}) @options = options @raw = str.to_s end def db super(@options[:connection_ref]) end def name @options[:hashed_label] ? hash : @raw end def hash @hash ||= Digest::SHA1.hexdigest(@raw) end def save @saved = (db.set("#{KEY_LEBELS}#{hash}", @raw) == "OK") if @options[:hashed_label] self end def saved? @saved ||= false end def self.create(name, options = {}) self.new(name, options).save end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
redistat-0.0.9 | lib/redistat/label.rb |
redistat-0.0.8 | lib/redistat/label.rb |
redistat-0.0.7 | lib/redistat/label.rb |
redistat-0.0.6 | lib/redistat/label.rb |
redistat-0.0.5 | lib/redistat/label.rb |