Module: Trax::Core::Concern
- Defined in:
- lib/trax/core/concern.rb
Class Method Summary collapse
Instance Method Summary collapse
- #after_extended(&block) ⇒ Object
- #after_included(&block) ⇒ Object
- #included(base = nil, &block) ⇒ Object
Class Method Details
.extended(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/trax/core/concern.rb', line 4 def self.extended(base) base.extend(::ActiveSupport::Concern) trace = ::TracePoint.new(:end) do |tracepoint| if tracepoint.self.singleton_class.included_modules.first == base if base.instance_variable_defined?(:@_after_extended_block) tracepoint.self.module_exec(base, &base.instance_variable_get(:@_after_extended_block)) end trace.disable end end trace.enable base end |
Instance Method Details
#after_extended(&block) ⇒ Object
44 45 46 |
# File 'lib/trax/core/concern.rb', line 44 def after_extended(&block) self.instance_variable_set(:@_after_extended_block, block) end |
#after_included(&block) ⇒ Object
40 41 42 |
# File 'lib/trax/core/concern.rb', line 40 def after_included(&block) self.instance_variable_set(:@_after_included_block, block) end |
#included(base = nil, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/trax/core/concern.rb', line 22 def included(base = nil, &block) super(base, &block) if defined?(super) trace = ::TracePoint.new(:end) do |tracepoint| if tracepoint.self == base if self.instance_variable_defined?(:@_after_included_block) base.instance_eval(&self.instance_variable_get(:@_after_included_block)) end trace.disable end end trace.enable base end |