Class: Matcher

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

Defined Under Namespace

Classes: MatcherInstance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Matcher

Returns a new instance of Matcher.



4
5
6
7
# File 'lib/usagi/matcher.rb', line 4

def initialize(name, &block)
  @name = name
  @matcher = block
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/usagi/matcher.rb', line 2

def name
  @name
end

Instance Method Details

#matches?(api_value, args) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/usagi/matcher.rb', line 9

def matches?(api_value, args)
  mi = MatcherInstance.new(@matcher, api_value, args)
  raise mi.error_message unless mi.matches?
end