Class: JSONSkooma::Validators::Base
- Inherits:
-
Object
- Object
- JSONSkooma::Validators::Base
show all
- Defined in:
- lib/json_skooma/validators/base.rb
Direct Known Subclasses
Date, DateTime, Duration, Email, Hostname, IdnEmail, IdnHostname, Ipv4, Ipv6, Iri, IriReference, JSONPointer, Regex, RelativeJSONPointer, Time, Uri, UriReference, UriTemplate, Uuid
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Class Attribute Details
.instance_types ⇒ Object
Returns the value of attribute instance_types.
7
8
9
|
# File 'lib/json_skooma/validators/base.rb', line 7
def instance_types
@instance_types
end
|
Class Method Details
.assert?(instance) ⇒ Boolean
13
14
15
|
# File 'lib/json_skooma/validators/base.rb', line 13
def assert?(instance)
instance_types.include?(instance.type)
end
|
.call(instance) ⇒ Object
17
18
19
|
# File 'lib/json_skooma/validators/base.rb', line 17
def call(instance)
new.call(instance)
end
|
.inherited(subclass) ⇒ Object
21
22
23
|
# File 'lib/json_skooma/validators/base.rb', line 21
def inherited(subclass)
subclass.instance_types = "string"
end
|
Instance Method Details
#call(_instance) ⇒ Object
26
27
28
|
# File 'lib/json_skooma/validators/base.rb', line 26
def call(_instance)
raise NotImplementedError, "must be implemented by subclass"
end
|