Module: Espresso::Concern
- Included in:
- Controller, Espresso::Controller::InheritedResourcesModifications, Model, Resources, View
- Defined in:
- lib/espresso/concern.rb
Overview
Code extracted from ActiveSupport 3.0.0beta
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
6 7 8 |
# File 'lib/espresso/concern.rb', line 6 def self.extended(base) base.instance_variable_set('@_dependencies', []) end |
Instance Method Details
#append_features(base) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/espresso/concern.rb', line 10 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') if instance_variable_defined?('@_included_blocks') @_included_blocks.each do |included_block| base.class_eval(&included_block) end end end end |
#included(base = nil, &block) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/espresso/concern.rb', line 28 def included(base = nil, &block) if base.nil? @_included_blocks ||= [] @_included_blocks << block else super end end |