Redistat::Key uses Redistat::Date internally

This commit is contained in:
2010-07-19 02:28:02 +03:00
parent 5bd2301102
commit fd1f1556c9

View File

@@ -8,7 +8,7 @@ module Redistat
def initialize(scope, label = nil, date = nil, options = {})
@scope = scope
@label = Label.create(label) if !label.nil?
@date = date ||= Time.now
@date = Date.new(date ||= Time.now) # Redistat::Date, not ::Date
@options = options
end
@@ -18,10 +18,11 @@ module Redistat
end
end
def to_s
def to_s(depth = nil)
depth ||= @options[:depth] if !@options[:depth].nil?
key = "#{@scope}"
key << "/#{label}" if !label.nil?
key << ":#{@date.to_redistat(@options[:depth] ||= nil)}"
key << ":#{@date.to_s(depth)}"
end
end