Class: LittleGhost::Tool::SchemaValidator
- Inherits:
-
Object
- Object
- LittleGhost::Tool::SchemaValidator
- Defined in:
- lib/little_ghost/tool.rb
Overview
:nodoc:
Constant Summary collapse
- REGEXP_TIMEOUT =
0.05
Instance Method Summary collapse
-
#initialize(schema, prompt_renderer: nil) ⇒ SchemaValidator
constructor
A new instance of SchemaValidator.
- #validate(value) ⇒ Object
Constructor Details
#initialize(schema, prompt_renderer: nil) ⇒ SchemaValidator
Returns a new instance of SchemaValidator.
485 486 487 488 489 |
# File 'lib/little_ghost/tool.rb', line 485 def initialize(schema, prompt_renderer: nil) @schema = schema prompts = FrameworkPrompts.new @prompt_renderer = prompt_renderer || ->(key, **locals) { prompts.render(key, locals:) } end |
Instance Method Details
#validate(value) ⇒ Object
491 492 493 494 495 |
# File 'lib/little_ghost/tool.rb', line 491 def validate(value) errors = [] validate_value(@schema, value, "$", errors) errors end |