Class: AWSCDK::Assertions::Matcher

Inherits:
Jsii::Object
  • Object
show all
Defined in:
assertions/matcher.rb

Overview

Represents a matcher that can perform special data matching capabilities between a given pattern and a target.

Direct Known Subclasses

Capture

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMatcher

Returns a new instance of Matcher.



8
9
10
# File 'assertions/matcher.rb', line 8

def initialize
  Jsii::Object.instance_method(:initialize).bind(self).call
end

Class Method Details

.is_matcher(x) ⇒ Boolean

Check whether the provided object is a subtype of the IMatcher.

Parameters:

  • x (Object)

Returns:

  • (Boolean)


23
24
25
26
# File 'assertions/matcher.rb', line 23

def self.is_matcher(x)
  Jsii::Type.check_type(x, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "x")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.assertions.Matcher", "isMatcher", [x])
end

.jsii_overridable_methodsObject



12
13
14
15
16
17
# File 'assertions/matcher.rb', line 12

def self.jsii_overridable_methods
  {
    :name => { kind: :property, name: "name", is_optional: false },
    :test => { kind: :method, name: "test", is_optional: false },
  }
end

Instance Method Details

#nameString

A name for the matcher.

This is collected as part of the result and may be presented to the user.

Returns:

  • (String)


33
34
35
# File 'assertions/matcher.rb', line 33

def name()
  jsii_get_property("name")
end

#test(actual) ⇒ AWSCDK::Assertions::MatchResult

Test whether a target matches the provided pattern.

Every Matcher must implement this method. This method will be invoked by the assertions framework. Do not call this method directly.

Parameters:

  • actual (Object)

    the target to match.

Returns:



44
45
46
47
# File 'assertions/matcher.rb', line 44

def test(actual)
  Jsii::Type.check_type(actual, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "actual")
  jsii_call_method("test", [actual])
end