class Aspector::MethodMatcher
Public Class Methods
new(*match_data)
click to toggle source
# File lib/aspector/method_matcher.rb, line 3 def initialize(*match_data) @match_data = match_data @match_data.flatten! end
Public Instance Methods
match?(method, aspect = nil)
click to toggle source
# File lib/aspector/method_matcher.rb, line 8 def match?(method, aspect = nil) @match_data.detect do |item| case item when String item == method when Regexp item =~ method when Symbol item.to_s == method when DeferredLogic value = aspect.deferred_logic_results(item) if value new_matcher = MethodMatcher.new(value) new_matcher.match?(method) end when DeferredOption value = aspect.options[item.key] if value new_matcher = MethodMatcher.new(value) new_matcher.match?(method) end end end end
to_s()
click to toggle source
# File lib/aspector/method_matcher.rb, line 39 def to_s @match_data.map(&:inspect).join(', ') end
use_deferred_logic?(logic)
click to toggle source
# File lib/aspector/method_matcher.rb, line 33 def use_deferred_logic?(logic) @match_data.detect do |item| logic == item end end