class Sleek::Namespace
Attributes
name[R]
Public Class Methods
new(name)
click to toggle source
Internal: Initialize Sleek
with namespace.
namespace - the Symbol namespace name.
# File lib/sleek/namespace.rb, line 8 def initialize(name) @name = name end
Public Instance Methods
delete!()
click to toggle source
Public: Delete the namespace.
# File lib/sleek/namespace.rb, line 26 def delete! events.delete_all end
delete_bucket(bucket)
click to toggle source
Public: Delete event bucket.
bucket - the String bucket name.
# File lib/sleek/namespace.rb, line 33 def delete_bucket(bucket) events(bucket).delete_all end
delete_property(bucket, property)
click to toggle source
Public: Delete specific property from all events in the bucket.
bucket - the String bucket name. property - the String property name.
# File lib/sleek/namespace.rb, line 41 def delete_property(bucket, property) events(bucket).unset("d.#{property}") end
events(bucket = nil)
click to toggle source
Internal: Get events associated with current namespace and, optionally, specified bucket.
# File lib/sleek/namespace.rb, line 47 def events(bucket = nil) evts = Event.where(namespace: name) evts = evts.where(bucket: bucket) if bucket.present? evts end
inspect()
click to toggle source
# File lib/sleek/namespace.rb, line 53 def inspect "#<Sleek::Namespace #{name}>" end
queries()
click to toggle source
Public: Get `QueriesCollection` for the namespace.
# File lib/sleek/namespace.rb, line 21 def queries @queries ||= QueryCollection.new(self) end
record(bucket, payload)
click to toggle source
Public: Record an event.
bucket - the String name of bucket. payload - the Hash of event data.
# File lib/sleek/namespace.rb, line 16 def record(bucket, payload) Event.create_with_namespace(name, bucket, payload) end