Class: Idcf::JsonHyperSchema::Analyst
- Inherits:
-
Object
- Object
- Idcf::JsonHyperSchema::Analyst
- Defined in:
- lib/idcf/json_hyper_schema/analyst.rb
Overview
json-hyper-schema analyst
Instance Attribute Summary collapse
-
#load_schema ⇒ Object
readonly
Returns the value of attribute load_schema.
-
#process_version ⇒ Object
readonly
Returns the value of attribute process_version.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
-
#expand(schema, options = {}) ⇒ Expand::Base
json file laod.
- #json_schema_init ⇒ Object
-
#links ⇒ Object
links.
-
#load(path, options = {}) ⇒ Hash
json file laod.
-
#schema_links(schema, options = {}) ⇒ Object
schema links.
Instance Attribute Details
#load_schema ⇒ Object (readonly)
Returns the value of attribute load_schema.
7 8 9 |
# File 'lib/idcf/json_hyper_schema/analyst.rb', line 7 def load_schema @load_schema end |
#process_version ⇒ Object (readonly)
Returns the value of attribute process_version.
7 8 9 |
# File 'lib/idcf/json_hyper_schema/analyst.rb', line 7 def process_version @process_version end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
7 8 9 |
# File 'lib/idcf/json_hyper_schema/analyst.rb', line 7 def schema @schema end |
Instance Method Details
#expand(schema, options = {}) ⇒ Expand::Base
json file laod
41 42 43 44 45 46 47 |
# File 'lib/idcf/json_hyper_schema/analyst.rb', line 41 def (schema, = {}) return schema unless schema.class == Hash @process_version = schema_version(schema) result = .new() result.do!(schema) result end |
#json_schema_init ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/idcf/json_hyper_schema/analyst.rb', line 9 def json_schema_init configuration = JsonSchema.configuration Idcf::JsonHyperSchema::Validation.validations.each do |key, val| configuration.register_format(key, val) end self end |
#links ⇒ Object
links
52 53 54 55 56 57 58 |
# File 'lib/idcf/json_hyper_schema/analyst.rb', line 52 def links json_schema_init p_schema = JsonSchema.parse!(@load_schema) @process_version = schema_version(p_schema) p_schema. find_links(p_schema) end |
#load(path, options = {}) ⇒ Hash
json file laod
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/idcf/json_hyper_schema/analyst.rb', line 23 def load(path, = {}) @schema ||= {} unless @schema[path].nil? @load_schema = @schema[path] return self end j = JSON.parse(File.read(path)) @load_schema = (j, ).schema @schema[path] = @load_schema self end |
#schema_links(schema, options = {}) ⇒ Object
schema links
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/idcf/json_hyper_schema/analyst.rb', line 65 def schema_links(schema, = {}) ex_schema = (schema, ) json_schema_init p_schema = JsonSchema.parse!(ex_schema.schema) t_v = @process_version p_schema. result = find_links(p_schema) @process_version = t_v result end |