类: RSpec::Matchers::BuiltIn::BeBetween 私有
- 继承
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::BeBetween
- 定义于
- lib/rspec/matchers/built_in/be_between.rb
概述
此类属于私有 API 的一部分。 尽可能避免使用此类,因为它将来可能会被移除或更改。
为 be_between
提供实现。不建议直接实例化。
常量摘要
从 BaseMatcher 继承的常量
RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED
实例方法摘要 折叠
- #description ⇒ String 私有
-
#exclusive ⇒ Object
使 between 比较变为排他性。
- #failure_message ⇒ String 私有
-
#inclusive ⇒ Object
使 between 比较变为包含性。
-
#initialize(min, max) ⇒ BeBetween 构造函数 私有
BeBetween 的一个新实例。
- #matches?(actual) ⇒ Boolean 私有
从 BaseMatcher 继承的方法
#diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
从 RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages 包含的方法
从 Composable 包含的方法
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
构造函数详细信息
#initialize(min, max) ⇒BeBetween
此方法属于私有 API 的一部分。 尽可能避免使用此方法,因为它将来可能会被移除或更改。
返回 BeBetween 的一个新实例。
8 9 10 11 |
# File 'lib/rspec/matchers/built_in/be_between.rb', line 8 def initialize(min, max) @min, @max = min, max inclusive end |
实例方法详细信息
#description ⇒String
此方法属于私有 API 的一部分。 尽可能避免使用此方法,因为它将来可能会被移除或更改。
57 58 59 |
# File 'lib/rspec/matchers/built_in/be_between.rb', line 57 def description "be between #{description_of @min} and #{description_of @max} (#{@mode})" end |
#exclusive ⇒Object
使 between 比较变为排他性。
33 34 35 36 37 38 |
# File 'lib/rspec/matchers/built_in/be_between.rb', line 33 def exclusive @less_than_operator = :< @greater_than_operator = :> @mode = :exclusive self end |
#failure_message ⇒String
此方法属于私有 API 的一部分。 尽可能避免使用此方法,因为它将来可能会被移除或更改。
51 52 53 |
# File 'lib/rspec/matchers/built_in/be_between.rb', line 51 def "#{super}#{not_comparable_clause}" end |
#inclusive ⇒Object
注意
匹配器默认情况下是包含性的;这只是提供了一种更明确的方式。
使 between 比较变为包含性。
21 22 23 24 25 26 |
# File 'lib/rspec/matchers/built_in/be_between.rb', line 21 def inclusive @less_than_operator = :<= @greater_than_operator = :>= @mode = :inclusive self end |
#matches?(actual) ⇒Boolean
此方法属于私有 API 的一部分。 尽可能避免使用此方法,因为它将来可能会被移除或更改。
42 43 44 45 46 47 |
# File 'lib/rspec/matchers/built_in/be_between.rb', line 42 def matches?(actual) @actual = actual comparable? && compare rescue ArgumentError false end |