Sha256: 1808d8d0080ed1593afec4cf0f7741d61678b1800b8d6eab93f899f10abb4b41

Contents?: true

Size: 580 Bytes

Versions: 1

Compression:

Stored size: 580 Bytes

Contents

module Aspect4r
  module Model
    class Advice
      BEFORE = 1
      AFTER  = 2
      AROUND = 3
    
      attr_accessor :type, :with_method, :options
    
      def initialize type, with_method, options = {}
        @type        = type
        @with_method = with_method
        @options     = options
      end
    
      def name
        options[:name] || with_method
      end
    
      %w(before after around).each do |aspect|
        class_eval <<-CODE
          def #{aspect}? 
            type == #{aspect.upcase}
          end
        CODE
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aspect4r-0.7.1 lib/aspect4r/model/advice.rb