Class: RuleTable::ConfiguredMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rule_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matcher_name, *args) ⇒ ConfiguredMatcher

Returns a new instance of ConfiguredMatcher.



71
72
73
74
75
# File 'lib/rule_table.rb', line 71

def initialize(matcher_name, *args)
  @matcher_name = matcher_name
  @matcher = RuleTable.matchers.fetch(matcher_name)
  @args    = args
end

Instance Attribute Details

#matcher_nameObject (readonly)

Returns the value of attribute matcher_name.



69
70
71
# File 'lib/rule_table.rb', line 69

def matcher_name
  @matcher_name
end

Instance Method Details

#matches?(object) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/rule_table.rb', line 77

def matches?(object)
  object.instance_exec(*@args, &@matcher)
end