Class: Shale::Schema::JSONGenerator::Ref Private
- Defined in:
- lib/shale/schema/json_generator/ref.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class representing JSON Schema reference
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#as_type ⇒ Hash
private
Return JSON Schema fragment as Ruby Hash.
-
#initialize(name, type, schema: nil) ⇒ Ref
constructor
private
A new instance of Ref.
Methods inherited from Base
Constructor Details
#initialize(name, type, schema: nil) ⇒ Ref
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Ref.
12 13 14 15 |
# File 'lib/shale/schema/json_generator/ref.rb', line 12 def initialize(name, type, schema: nil) super(name, schema: schema) @type = type.gsub('::', '_') end |
Instance Method Details
#as_type ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return JSON Schema fragment as Ruby Hash
22 23 24 |
# File 'lib/shale/schema/json_generator/ref.rb', line 22 def as_type { '$ref' => "#/$defs/#{@type}" } end |