Class: Observ::PromptConfigValidator
- Inherits:
-
Object
- Object
- Observ::PromptConfigValidator
- Defined in:
- app/validators/observ/prompt_config_validator.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(config) ⇒ PromptConfigValidator
constructor
A new instance of PromptConfigValidator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(config) ⇒ PromptConfigValidator
Returns a new instance of PromptConfigValidator.
7 8 9 10 |
# File 'app/validators/observ/prompt_config_validator.rb', line 7 def initialize(config) @config = config @errors = [] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'app/validators/observ/prompt_config_validator.rb', line 5 def config @config end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'app/validators/observ/prompt_config_validator.rb', line 5 def errors @errors end |
Instance Method Details
#valid? ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/validators/observ/prompt_config_validator.rb', line 12 def valid? @errors = [] return true if config.blank? unless config.is_a?(Hash) @errors << "Config must be a Hash" return false end validate_against_schema @errors.empty? end |