Class: Jouba::Aggregate

Inherits:
Module
  • Object
show all
Defined in:
lib/jouba/aggregate.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Aggregate

Returns a new instance of Aggregate.



8
9
10
11
12
13
14
15
16
# File 'lib/jouba/aggregate.rb', line 8

def initialize(options = {})
  @options = options
  tap do |mod|
    mod.define_singleton_method :included do |object|
      super(object)
      after_included(object, mod)
    end
  end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/jouba/aggregate.rb', line 6

def options
  @options
end

Instance Method Details

#after_included(object, mod) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/jouba/aggregate.rb', line 18

def after_included(object, mod)
  object.extend(ClassMethods)
  object.send :include, InstanceMethods
  object.send :include, Wisper::Publisher
  object.define_singleton_method :__module_options__ do
    mod.options
  end
end