Class: Spectus::ExpectationTarget
- Inherits:
-
Object
- Object
- Spectus::ExpectationTarget
- Defined in:
- lib/spectus/expectation_target.rb
Overview
Wraps the target of an expectation.
Instance Method Summary collapse
-
#initialize(&subject) ⇒ ExpectationTarget
constructor
private
Create a new expection target.
-
#MAY(m) ⇒ Result::Fail, Result::Pass
This word, or the adjective “OPTIONAL”, mean that an item is truly optional.
- #MAY!(m) ⇒ Object
-
#MUST(m) ⇒ Result::Fail, Result::Pass
This word, or the terms “REQUIRED” or “SHALL”, mean that the definition is an absolute requirement of the specification.
- #MUST!(m) ⇒ Object
-
#MUST_NOT(m) ⇒ Result::Fail, Result::Pass
This phrase, or the phrase “SHALL NOT”, mean that the definition is an absolute prohibition of the specification.
- #MUST_NOT!(m) ⇒ Object
-
#SHOULD(m) ⇒ Result::Fail, Result::Pass
This word, or the adjective “RECOMMENDED”, mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
- #SHOULD!(m) ⇒ Object
-
#SHOULD_NOT(m) ⇒ Result::Fail, Result::Pass
This phrase, or the phrase “NOT RECOMMENDED” mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label.
- #SHOULD_NOT!(m) ⇒ Object
Constructor Details
#initialize(&subject) ⇒ ExpectationTarget
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new expection target
18 19 20 21 |
# File 'lib/spectus/expectation_target.rb', line 18 def initialize(&subject) @subject = subject @challenges = [block_challenge] end |
Instance Method Details
#MAY(m) ⇒ Result::Fail, Result::Pass
This word, or the adjective “OPTIONAL”, mean that an item is truly optional. One vendor may choose to include the item because a particular marketplace requires it or because the vendor feels that it enhances the product while another vendor may omit the same item. An implementation which does not include a particular option MUST be prepared to interoperate with another implementation which does include the option, though perhaps with reduced functionality. In the same vein an implementation which does include a particular option MUST be prepared to interoperate with another implementation which does not include the option (except, of course, for the feature the option provides.)
135 136 137 |
# File 'lib/spectus/expectation_target.rb', line 135 def MAY(m) RequirementLevel::Low.new(m, false, subject, *challenges).result end |
#MAY!(m) ⇒ Object
143 144 145 |
# File 'lib/spectus/expectation_target.rb', line 143 def MAY!(m) RequirementLevel::Low.new(m, false, subject, *challenges).result(true) end |
#MUST(m) ⇒ Result::Fail, Result::Pass
This word, or the terms “REQUIRED” or “SHALL”, mean that the definition is an absolute requirement of the specification.
37 38 39 |
# File 'lib/spectus/expectation_target.rb', line 37 def MUST(m) RequirementLevel::High.new(m, false, subject, *challenges).result end |
#MUST!(m) ⇒ Object
45 46 47 |
# File 'lib/spectus/expectation_target.rb', line 45 def MUST!(m) RequirementLevel::High.new(m, false, subject, *challenges).result(true) end |
#MUST_NOT(m) ⇒ Result::Fail, Result::Pass
This phrase, or the phrase “SHALL NOT”, mean that the definition is an absolute prohibition of the specification.
58 59 60 |
# File 'lib/spectus/expectation_target.rb', line 58 def MUST_NOT(m) RequirementLevel::High.new(m, true, subject, *challenges).result end |
#MUST_NOT!(m) ⇒ Object
66 67 68 |
# File 'lib/spectus/expectation_target.rb', line 66 def MUST_NOT!(m) RequirementLevel::High.new(m, true, subject, *challenges).result(true) end |
#SHOULD(m) ⇒ Result::Fail, Result::Pass
This word, or the adjective “RECOMMENDED”, mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
81 82 83 |
# File 'lib/spectus/expectation_target.rb', line 81 def SHOULD(m) RequirementLevel::Medium.new(m, false, subject, *challenges).result end |
#SHOULD!(m) ⇒ Object
89 90 91 |
# File 'lib/spectus/expectation_target.rb', line 89 def SHOULD!(m) RequirementLevel::Medium.new(m, false, subject, *challenges).result(true) end |
#SHOULD_NOT(m) ⇒ Result::Fail, Result::Pass
This phrase, or the phrase “NOT RECOMMENDED” mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label.
105 106 107 |
# File 'lib/spectus/expectation_target.rb', line 105 def SHOULD_NOT(m) RequirementLevel::Medium.new(m, true, subject, *challenges).result end |
#SHOULD_NOT!(m) ⇒ Object
113 114 115 |
# File 'lib/spectus/expectation_target.rb', line 113 def SHOULD_NOT!(m) RequirementLevel::Medium.new(m, true, subject, *challenges).result(true) end |