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.
11 12 13 |
# File 'lib/freno/client/preconditions.rb', line 11 def initialize @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/freno/client/preconditions.rb', line 9 def errors @errors end |
Instance Method Details
#present(args = {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/freno/client/preconditions.rb', line 15 def present(args = {}) args.each do |arg, value| unless value errors << "#{arg} should be present" end end end |
#report ⇒ Object
23 24 25 |
# File 'lib/freno/client/preconditions.rb', line 23 def report raise PreconditionNotMet.new(errors.join("\n")) unless errors.empty? end |