Class: JsonSchemaView::JsonWorldExtensions::EnumType
- Inherits:
-
Object
- Object
- JsonSchemaView::JsonWorldExtensions::EnumType
- Defined in:
- lib/json_schema_view/json_world_extensions/enum_type.rb
Overview
This module allows JsonWorld::DSL::ClassMethods#property to define enum values. Defined constant values are reflect to JSON Schema.
Defined Under Namespace
Modules: DSL
Instance Attribute Summary collapse
-
#candidates ⇒ Object
readonly
Returns the value of attribute candidates.
Instance Method Summary collapse
- #as_json_schema ⇒ Object (also: #as_json_schema_without_links)
-
#initialize(*candidates) ⇒ EnumType
constructor
A new instance of EnumType.
Constructor Details
#initialize(*candidates) ⇒ EnumType
Returns a new instance of EnumType.
32 33 34 |
# File 'lib/json_schema_view/json_world_extensions/enum_type.rb', line 32 def initialize(*candidates) @candidates = candidates end |
Instance Attribute Details
#candidates ⇒ Object (readonly)
Returns the value of attribute candidates.
28 29 30 |
# File 'lib/json_schema_view/json_world_extensions/enum_type.rb', line 28 def candidates @candidates end |
Instance Method Details
#as_json_schema ⇒ Object Also known as: as_json_schema_without_links
36 37 38 39 40 |
# File 'lib/json_schema_view/json_world_extensions/enum_type.rb', line 36 def as_json_schema { enum: candidates } end |