Sha256: b8d158479ebdbb2a7b4ef43e4bbf77391315922873a79f652a663987a02344f3

Contents?: true

Size: 962 Bytes

Versions: 1

Compression:

Stored size: 962 Bytes

Contents

class Module
  def included_with_a4r(base)
    included_without_a4r(child) if respond_to?(:included_without_a4r)
    
    return if @a4r_data.nil? or @a4r_data.empty?
  
    base.send(:include, Aspect4r)
    
    existing_aspects = base.a4r_data
    existing_aspects.methods_with_advices.merge(@a4r_data.methods_with_advices)    
  end
  
  alias included_without_a4r included
  alias included             included_with_a4r
  
  def method_added_with_a4r(method)
    method_added_without_a4r(child) if respond_to?(:method_added_without_a4r)
    
    return if method.to_s =~ /a4r/

    # save unbound method and create new method
    if not Aspect4r::Helper.creating_method? and @a4r_data and method_advices = @a4r_data[method]
      method_advices.wrapped_method = instance_method(method)
      Aspect4r::Helper.create_method self, method
    end
  end
  
  alias method_added_without_a4r method_added
  alias method_added             method_added_with_a4r
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aspect4r-0.7.1 lib/aspect4r/extensions/module_extension.rb