Class: Jobshop::Inspection::BooleanCriterion
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Jobshop::Inspection::BooleanCriterion
- Defined in:
- app/models/jobshop/inspection/boolean_criterion.rb
Instance Method Summary collapse
- #criterion ⇒ Object
- #pass?(value) ⇒ Boolean
-
#random ⇒ Object
Generate a random value that has a 90% chance of being in spec.
- #tolerance ⇒ Object
- #unit ⇒ Object
Instance Method Details
#criterion ⇒ Object
17 18 19 |
# File 'app/models/jobshop/inspection/boolean_criterion.rb', line 17 def criterion super || build_criterion end |
#pass?(value) ⇒ Boolean
31 32 33 |
# File 'app/models/jobshop/inspection/boolean_criterion.rb', line 31 def pass?(value) ![ false, 0, "0", "f", "F", "false", "FALSE", "off", "OFF" ].include?(value) end |
#random ⇒ Object
Generate a random value that has a 90% chance of being in spec. TODO: This needs to go in the tests somewhere, not really in the model. :nocov:
38 39 40 |
# File 'app/models/jobshop/inspection/boolean_criterion.rb', line 38 def random rand(100) < 10 end |
#tolerance ⇒ Object
23 24 25 |
# File 'app/models/jobshop/inspection/boolean_criterion.rb', line 23 def tolerance @tolerance ||= condition end |
#unit ⇒ Object
27 28 29 |
# File 'app/models/jobshop/inspection/boolean_criterion.rb', line 27 def unit "boolean".freeze end |