Module: CassandraMapper::Support::Concern

Included in:
Observing, SupportCallbacks
Defined in:
lib/cassandra_mapper/support/concern.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
# File 'lib/cassandra_mapper/support/concern.rb', line 4

def self.extended(base)
  base.instance_variable_set("@_dependencies", [])
end

Instance Method Details

#append_features(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cassandra_mapper/support/concern.rb', line 8

def append_features(base)
  if base.instance_variable_defined?("@_dependencies")
    base.instance_variable_get("@_dependencies") << self
    return false
  else
    return false if base < self
    @_dependencies.each { |dep| base.send(:include, dep) }
    super
    base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
    base.send :include, const_get("InstanceMethods") if const_defined?("InstanceMethods")
    base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
  end
end

#included(base = nil, &block) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/cassandra_mapper/support/concern.rb', line 22

def included(base = nil, &block)
  if base.nil?
    @_included_block = block
  else
    super
  end
end