Module: ActiveSupport::Concern
- Included in:
- EasyAuth::Controllers::Authenticated, EasyAuth::Controllers::Sessions, EasyAuth::Helpers::EasyAuth, EasyAuth::Models::Account, EasyAuth::Models::Identity
- Defined in:
- lib/easy_auth/active_support/concern.rb
Instance Method Summary collapse
- #append_features(base) ⇒ Object
- #prepend_features(base) ⇒ Object
- #prepended(base = nil, &block) ⇒ Object
Instance Method Details
#append_features(base) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/easy_auth/active_support/concern.rb', line 2 def append_features(base) if base.instance_variable_defined?("@_dependencies") base.instance_variable_get("@_dependencies") << { :method => :include, :module => self } return false else return false if base < self @_dependencies.each { |dep| Hash === dep ? base.send(dep[:method], dep[:module]) : base.send(:include, dep) } super base.extend const_get("ClassMethods") if const_defined?("ClassMethods") base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block") end end |
#prepend_features(base) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/easy_auth/active_support/concern.rb', line 15 def prepend_features(base) if base.instance_variable_defined?("@_dependencies") base.instance_variable_get("@_dependencies").unshift({ :method => :prepend, :module => self }) return false else return false if base < self super base.singleton_class.send(:prepend, const_get("ClassMethods")) if const_defined?("ClassMethods") @_dependencies.each { |dep| Hash === dep ? base.send(dep[:method], dep[:module]) : base.send(:prepend, dep) } base.class_eval(&@_prepended_block) if instance_variable_defined?("@_prepended_block") end end |
#prepended(base = nil, &block) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/easy_auth/active_support/concern.rb', line 28 def prepended(base = nil, &block) if base.nil? raise MultipleIncludedBlocks if instance_variable_defined?("@_prepended_block") @_prepended_block = block else super end end |