lib/trackoid/aggregates.rb in trackoid-0.3.7 vs lib/trackoid/aggregates.rb in trackoid-0.3.8
- old
+ new
@@ -1,12 +1,12 @@
# encoding: utf-8
module Mongoid #:nodoc:
module Tracking #:nodoc:
module Aggregates
-
+
DEPRECATED_TOKENS = ['hour', 'hours']
-
+
# This module includes aggregate data extensions to Trackoid instances
def self.included(base)
base.class_eval do
extend ClassMethods
@@ -19,11 +19,11 @@
end
module ClassMethods
# Defines an aggregate token to an already tracked model. It defines
# a new mongoid model named after the original model.
- #
+ #
# Example:
#
# <tt>class Page</tt>
# <tt> include Mongoid::Document</tt>
# <tt> include Mongoid::Tracking</tt>
@@ -34,11 +34,11 @@
# <tt>end</tt>
#
# A new model is defined as <tt>class PageAggregates</tt>
#
# This model has the following structure:
- #
+ #
# <tt>belongs_to :page</tt>
# <tt>field :ns, :type => String</tt>
# <tt>field :key, :type => String</tt>
# <tt>index [:page_id, :ns, :key], :unique => true</tt>
# <tt>track :[original_parent_tracking_data]</tt>
@@ -130,11 +130,11 @@
# the original class model but with "Aggregates" appended.
# Example: TestModel ==> TestModelAggregates
def define_klass(&block)
scope = internal_aggregates_name.split('::')
klass = scope.pop
- scope = scope.inject(Kernel) {|scope, const_name| scope.const_get(const_name)}
+ scope = scope.inject(Object) {|scope, const_name| scope.const_get(const_name)}
klass = scope.const_set(klass, Class.new)
klass.class_eval(&block)
end
def create_aggregation_accessors(name)
@@ -150,9 +150,9 @@
define_method("#{name}=") do
raise NoMethodError
end
end
end
-
+
end
end
end