Class: Idcf::JsonHyperSchema::Expands::Base
- Inherits:
-
Object
- Object
- Idcf::JsonHyperSchema::Expands::Base
- Defined in:
- lib/idcf/json_hyper_schema/expands/base.rb
Overview
json schema expand json schema v4
Direct Known Subclasses
Constant Summary collapse
- FULL_HREF_REGEXP =
Regexp.new('\A[a-zA-Z]*:?//').freeze
Instance Attribute Summary collapse
-
#definition_ids ⇒ Object
readonly
Returns the value of attribute definition_ids.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
-
#do!(schema) ⇒ Hash
do.
-
#find(path) ⇒ Object
ref find.
-
#initialize(global_access: true) ⇒ Base
constructor
initialize.
Constructor Details
#initialize(global_access: true) ⇒ Base
initialize
18 19 20 21 22 23 24 |
# File 'lib/idcf/json_hyper_schema/expands/base.rb', line 18 def initialize(global_access: true) @definition_ids = {} @options = { global_access: global_access } end |
Instance Attribute Details
#definition_ids ⇒ Object (readonly)
Returns the value of attribute definition_ids.
10 11 12 |
# File 'lib/idcf/json_hyper_schema/expands/base.rb', line 10 def definition_ids @definition_ids end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/idcf/json_hyper_schema/expands/base.rb', line 10 def @options end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
10 11 12 |
# File 'lib/idcf/json_hyper_schema/expands/base.rb', line 10 def origin @origin end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
10 11 12 |
# File 'lib/idcf/json_hyper_schema/expands/base.rb', line 10 def schema @schema end |
Instance Method Details
#do!(schema) ⇒ Hash
do
31 32 33 34 35 36 37 38 |
# File 'lib/idcf/json_hyper_schema/expands/base.rb', line 31 def do!(schema) raise 'schema is not hash' unless schema.class == Hash target = schema.deep_dup @origin = schema.deep_dup @definition_ids = delete_id(make_ids(target)) @schema = exp(target) @schema end |
#find(path) ⇒ Object
ref find
44 45 46 47 48 49 50 51 |
# File 'lib/idcf/json_hyper_schema/expands/base.rb', line 44 def find(path) if path =~ FULL_HREF_REGEXP return path unless @options[:global_access] global_find(path) else local_search(path) end end |