Sha256: 336fbd0fb1d42fc1119c9b1c905baa7d327d7dd9aa5dfa2709fa25af0bdfe4f6

Contents?: true

Size: 584 Bytes

Versions: 4

Compression:

Stored size: 584 Bytes

Contents

module Aspect4r
  module Model
    class AdvicesForMethod < Array
      attr_reader :method
      attr_accessor :wrapped_method
    
      def initialize method
        @method = method
      end
    
      def add new_advice
        self << new_advice unless include?(new_advice)
      end

      def include? new_advice
        detect { |advice| advice.name == new_advice.name }
      end
      
      def [] index
        return super unless index.is_a? String or index.is_a? Symbol
        
        detect {|advice| advice.name.to_sym == index.to_sym }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aspect4r-0.9.0 lib/aspect4r/model/advices_for_method.rb
aspect4r-0.8.2 lib/aspect4r/model/advices_for_method.rb
aspect4r-0.8.1 lib/aspect4r/model/advices_for_method.rb
aspect4r-0.8.0 lib/aspect4r/model/advices_for_method.rb