Module: EasyAuth::ReverseConcern

Included in:
Controllers::Authenticated, Controllers::Sessions, Models::Account, Models::Identity
Defined in:
lib/easy_auth/reverse_concern.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



2
3
4
# File 'lib/easy_auth/reverse_concern.rb', line 2

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

Instance Method Details

#append_features(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/easy_auth/reverse_concern.rb', line 6

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

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



19
20
21
22
23
24
25
# File 'lib/easy_auth/reverse_concern.rb', line 19

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