Class: Freno::Client::Preconditions::Checker
- Inherits:
-
Object
- Object
- Freno::Client::Preconditions::Checker
- Defined in:
- lib/freno/client/preconditions.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize ⇒ Checker
constructor
A new instance of Checker.
- #present(args = {}) ⇒ Object
- #report ⇒ Object
Constructor Details
#initialize ⇒ Checker
Returns a new instance of Checker.
13 14 15 |
# File 'lib/freno/client/preconditions.rb', line 13 def initialize @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
11 12 13 |
# File 'lib/freno/client/preconditions.rb', line 11 def errors @errors end |
Instance Method Details
#present(args = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/freno/client/preconditions.rb', line 17 def present(args = {}) args.each do |arg, value| errors << "#{arg} should be present" unless value end end |
#report ⇒ Object
23 24 25 |
# File 'lib/freno/client/preconditions.rb', line 23 def report raise PreconditionNotMet, errors.join("\n") unless errors.empty? end |