Sha256: abb714a60f0f617d2812f3832a417ede15fe47c6802cabdc779a68559465cd2a

Contents?: true

Size: 833 Bytes

Versions: 4

Compression:

Stored size: 833 Bytes

Contents

module Aspect4r
  module Model
    class Advice
      BEFORE = 1
      AFTER  = 2
      AROUND = 3
    
      attr :group
      attr_accessor :type, :with_method, :options
    
      def initialize type, with_method, group, options = {}
        @type        = type
        @with_method = with_method
        @group       = group
        @options     = options
      end
    
      def name
        options[:name] || with_method
      end
      
      def before?
        type == BEFORE and not options[:skip_if_false]
      end
      
      def before_filter?
        type == BEFORE and options[:skip_if_false]
      end
      
      def after?
        type == AFTER
      end
      
      def around?
        type == AROUND
      end
      
      def invoke obj, *args
        obj.send with_method, *args
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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