mirror of
https://github.com/jimeh/redistat.git
synced 2026-02-19 05:16:39 +00:00
exposed the scope attribute of Event and Key
objects
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
module Redistat
|
||||
class Event
|
||||
|
||||
attr_reader :scope
|
||||
attr_reader :key
|
||||
|
||||
attr_accessor :data
|
||||
attr_accessor :stats
|
||||
attr_accessor :meta
|
||||
attr_accessor :options
|
||||
|
||||
def initialize(scope, label = nil, data = {}, date = nil, options = {})
|
||||
@options = options
|
||||
def initialize(scope, label = nil, date = nil, stats = {}, meta = {}, options = {})
|
||||
@options = default_options.merge(options)
|
||||
@scope = scope
|
||||
@key = Key.new(scope, label, date, options)
|
||||
#TODO ...intialize Redistat::Event
|
||||
@key = Key.new(scope, label, date, @options)
|
||||
@stats = stats ||= {}
|
||||
@meta = meta ||= {}
|
||||
end
|
||||
|
||||
def default_options
|
||||
{ :depth => :hour, }
|
||||
end
|
||||
|
||||
def date
|
||||
@key.date.to_time
|
||||
@key.date
|
||||
end
|
||||
|
||||
def date=(input)
|
||||
@@ -25,6 +30,14 @@ module Redistat
|
||||
alias :time :date
|
||||
alias :time= :date=
|
||||
|
||||
def scope
|
||||
@key.scope
|
||||
end
|
||||
|
||||
def scope=(input)
|
||||
@key.scope = input
|
||||
end
|
||||
|
||||
def label
|
||||
@key.label
|
||||
end
|
||||
|
||||
@@ -3,12 +3,13 @@ module Redistat
|
||||
|
||||
attr_accessor :scope
|
||||
attr_accessor :date
|
||||
attr_accessor :options
|
||||
|
||||
def initialize(scope, label = nil, date = nil, options = {})
|
||||
@scope = scope
|
||||
self.label = label if !label.nil?
|
||||
self.date = date ||= Time.now
|
||||
@options = options
|
||||
self.options = options
|
||||
end
|
||||
|
||||
def date=(input)
|
||||
|
||||
Reference in New Issue
Block a user