class ADSL::Verification::InstrumentationFilter
Public Class Methods
new(options = {})
click to toggle source
# File lib/adsl/verification/instrumentation_filter.rb, line 5 def initialize(options = {}) options.keys.each do |key| options[key] = options[key].to_s if options[key].is_a? Symbol end @options = options end
Public Instance Methods
allow_instrumentation?(object, method_name)
click to toggle source
# File lib/adsl/verification/instrumentation_filter.rb, line 32 def allow_instrumentation?(object, method_name) !applies_to? object, method_name end
applies_to?(object, method_name)
click to toggle source
# File lib/adsl/verification/instrumentation_filter.rb, line 12 def applies_to?(object, method_name) unless @options[:method_name].nil? return false unless @options[:method_name] === method_name.to_s end unless @options[:method_owner].nil? return false if object.is_a?(Fixnum) or object.is_a?(Symbol) method = object.singleton_class.instance_method method_name return false unless method.owner == @options[:method_owner] end unless @options[:if].nil? subcondition = InstrumentationFilter.new(@options[:if]) return false if subcondition.applies_to? object, method_name end unless @options[:unless].nil? subcondition = InstrumentationFilter.new(@options[:unless]) return false unless subcondition.applies_to? object, method_name end true end