Class: GQLi::Validation
- Inherits:
-
Object
- Object
- GQLi::Validation
- Defined in:
- lib/gqli/validation.rb
Overview
Validations
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
-
#initialize(schema, root) ⇒ Validation
constructor
A new instance of Validation.
-
#valid? ⇒ Boolean
Returns wether the query is valid or not.
Constructor Details
#initialize(schema, root) ⇒ Validation
Returns a new instance of Validation.
8 9 10 11 12 13 14 |
# File 'lib/gqli/validation.rb', line 8 def initialize(schema, root) @schema = schema @root = root @errors = [] validate end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/gqli/validation.rb', line 6 def errors @errors end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
6 7 8 |
# File 'lib/gqli/validation.rb', line 6 def root @root end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
6 7 8 |
# File 'lib/gqli/validation.rb', line 6 def schema @schema end |
Instance Method Details
#valid? ⇒ Boolean
Returns wether the query is valid or not
17 18 19 |
# File 'lib/gqli/validation.rb', line 17 def valid? errors.empty? end |