类: RSpec::Matchers::BuiltIn::Match 私有
- 继承
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Match
- 定义于
- lib/rspec/matchers/built_in/match.rb
概述
此类是私有 API 的一部分。 如果可能,您应该避免使用此类,因为它可能会在将来被删除或更改。
为 match
提供实现。不打算直接实例化。
常量摘要
从 BaseMatcher 继承的常量
实例方法摘要 折叠
- #description ⇒ String 私有
- #diffable? ⇒ Boolean 私有
-
#initialize(expected) ⇒ Match 构造函数 私有
Match 的新实例。
-
#with_captures(*captures) ⇒ self 私有
用于指定我们匹配的捕获。
从 BaseMatcher 继承的方法
#expects_call_stack_jump?, #match_unless_raises, #matches?, #supports_block_expectations?
从 BaseMatcher::DefaultFailureMessages 包含的方法
#failure_message, #failure_message_when_negated
从 Composable 包含的方法
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
构造函数详情
#initialize(expected) ⇒Match
此方法是私有 API 的一部分。 如果可能,您应该避免使用此方法,因为它可能会在将来被删除或更改。
返回 Match 的新实例。
8 9 10 11 12 |
# File 'lib/rspec/matchers/built_in/match.rb', line 8 def initialize(expected) super(expected) @expected_captures = nil end |
实例方法详情
#description ⇒String
此方法是私有 API 的一部分。 如果可能,您应该避免使用此方法,因为它可能会在将来被删除或更改。
15 16 17 18 19 20 21 |
# File 'lib/rspec/matchers/built_in/match.rb', line 15 def description if @expected_captures && @expected.match(actual) "match #{surface_descriptions_in(expected).inspect} with captures #{surface_descriptions_in(@expected_captures).inspect}" else "match #{surface_descriptions_in(expected).inspect}" end end |
#diffable? ⇒Boolean
此方法是私有 API 的一部分。 如果可能,您应该避免使用此方法,因为它可能会在将来被删除或更改。
25 26 27 |
# File 'lib/rspec/matchers/built_in/match.rb', line 25 def diffable? true end |
#with_captures(*captures) ⇒self
此方法是私有 API 的一部分。 如果可能,您应该避免使用此方法,因为它可能会在将来被删除或更改。
用于指定我们匹配的捕获
31 32 33 34 |
# File 'lib/rspec/matchers/built_in/match.rb', line 31 def with_captures(*captures) @expected_captures = captures self end |