Module: Hdo::StortingImporter::HasJsonSchema

Overview

Includer must define these methods:

.schema_path
.example
#from_hash(hash)
#to_hash

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



20
21
22
# File 'lib/hdo/storting_importer/has_json_schema.rb', line 20

def self.included(base)
  base.extend ClassMethods
end

.schemasObject



16
17
18
# File 'lib/hdo/storting_importer/has_json_schema.rb', line 16

def self.schemas
  @schemas ||= []
end

Instance Method Details

#as_json(*args) ⇒ Object



28
29
30
# File 'lib/hdo/storting_importer/has_json_schema.rb', line 28

def as_json(*args)
  to_hash
end

#to_json(*args) ⇒ Object



24
25
26
# File 'lib/hdo/storting_importer/has_json_schema.rb', line 24

def to_json(*args)
  to_hash.to_json(*args)
end

#valid?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/hdo/storting_importer/has_json_schema.rb', line 32

def valid?
  self.class.valid? to_hash
end

#validate!Object



36
37
38
# File 'lib/hdo/storting_importer/has_json_schema.rb', line 36

def validate!
  self.class.validate! to_hash
end