Class: JSONSkooma::Keywords::Base
- Inherits:
-
Object
- Object
- JSONSkooma::Keywords::Base
show all
- Defined in:
- lib/json_skooma/keywords/base.rb
Direct Known Subclasses
Applicator::AdditionalProperties, Applicator::AllOf, Applicator::AnyOf, Applicator::Contains, Applicator::DependentSchemas, Applicator::Else, Applicator::If, Applicator::Items, Applicator::Not, Applicator::OneOf, Applicator::PatternProperties, Applicator::PrefixItems, Applicator::Properties, Applicator::PropertyNames, Applicator::Then, BaseAnnotation, Core::Anchor, Core::Comment, Core::Defs, Core::DynamicAnchor, Core::DynamicRef, Core::Id, Core::Ref, Core::Schema, Core::Vocabulary, Draft201909::AdditionalItems, Draft201909::Items, Draft201909::RecursiveAnchor, Draft201909::RecursiveRef, Draft201909::UnevaluatedItems, Draft201909::UnevaluatedProperties, FormatAnnotation::Format, Unevaluated::UnevaluatedItems, Unevaluated::UnevaluatedProperties, Validation::Const, Validation::DependentRequired, Validation::Enum, Validation::ExclusiveMaximum, Validation::ExclusiveMinimum, Validation::MaxContains, Validation::MaxItems, Validation::MaxLength, Validation::MaxProperties, Validation::Maximum, Validation::MinContains, Validation::MinItems, Validation::MinLength, Validation::MinProperties, Validation::Minimum, Validation::MultipleOf, Validation::Pattern, Validation::Required, Validation::Type, Validation::UniqueItems
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(parent_schema, value) ⇒ Base
Returns a new instance of Base.
38
39
40
41
|
# File 'lib/json_skooma/keywords/base.rb', line 38
def initialize(parent_schema, value)
@parent_schema = parent_schema
@json = wrap_value(value)
end
|
Class Attribute Details
.depends_on ⇒ Object
Returns the value of attribute depends_on.
9
10
11
|
# File 'lib/json_skooma/keywords/base.rb', line 9
def depends_on
@depends_on
end
|
.instance_types ⇒ Object
Returns the value of attribute instance_types.
11
12
13
|
# File 'lib/json_skooma/keywords/base.rb', line 11
def instance_types
@instance_types
end
|
.key ⇒ Object
13
14
15
|
# File 'lib/json_skooma/keywords/base.rb', line 13
def key
@key or raise "Key must be defined"
end
|
.schema_value_class ⇒ Object
Returns the value of attribute schema_value_class.
9
10
11
|
# File 'lib/json_skooma/keywords/base.rb', line 9
def schema_value_class
@schema_value_class
end
|
.static ⇒ Object
Returns the value of attribute static.
9
10
11
|
# File 'lib/json_skooma/keywords/base.rb', line 9
def static
@static
end
|
Instance Attribute Details
#json ⇒ Object
Returns the value of attribute json.
6
7
8
|
# File 'lib/json_skooma/keywords/base.rb', line 6
def json
@json
end
|
#parent_schema ⇒ Object
Returns the value of attribute parent_schema.
6
7
8
|
# File 'lib/json_skooma/keywords/base.rb', line 6
def parent_schema
@parent_schema
end
|
Class Method Details
.inherited(subclass) ⇒ Object
33
34
35
|
# File 'lib/json_skooma/keywords/base.rb', line 33
def inherited(subclass)
subclass.set_defaults
end
|
.set_defaults ⇒ Object
27
28
29
30
31
|
# File 'lib/json_skooma/keywords/base.rb', line 27
def set_defaults
@instance_types = %w[boolean object array string number null]
@static = false
@depends_on = []
end
|
.value_schema=(schema_keys) ⇒ Object
21
22
23
24
25
|
# File 'lib/json_skooma/keywords/base.rb', line 21
def value_schema=(schema_keys)
Array(schema_keys).each do |k|
prepend ValueSchemas[k]
end
end
|
Instance Method Details
#each_schema(&block) ⇒ Object
58
59
|
# File 'lib/json_skooma/keywords/base.rb', line 58
def each_schema(&block)
end
|
#evaluate(instance, result) ⇒ Object
55
56
|
# File 'lib/json_skooma/keywords/base.rb', line 55
def evaluate(instance, result)
end
|
#instance_types ⇒ Object
51
52
53
|
# File 'lib/json_skooma/keywords/base.rb', line 51
def instance_types
self.class.instance_types
end
|
#key ⇒ Object
43
44
45
|
# File 'lib/json_skooma/keywords/base.rb', line 43
def key
self.class.key
end
|
#resolve ⇒ Object
61
62
63
64
65
|
# File 'lib/json_skooma/keywords/base.rb', line 61
def resolve
each_schema do |schema|
schema.resolve_references if schema.respond_to?(:resolve_references)
end
end
|
#static ⇒ Object
47
48
49
|
# File 'lib/json_skooma/keywords/base.rb', line 47
def static
self.class.static
end
|