Class: Eazypi::Schema::Primitive
- Inherits:
-
Object
- Object
- Eazypi::Schema::Primitive
- Includes:
- Eazypi::SpecObject
- Defined in:
- lib/eazypi/schema/primitive.rb
Overview
Primitive schema definition
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #collect_components(**_kwargs) ⇒ Object
-
#initialize(type: nil, format: nil) ⇒ Primitive
constructor
A new instance of Primitive.
- #to_openapi_spec ⇒ Object
Methods included from Eazypi::SpecObject
Constructor Details
#initialize(type: nil, format: nil) ⇒ Primitive
Returns a new instance of Primitive.
11 12 13 14 |
# File 'lib/eazypi/schema/primitive.rb', line 11 def initialize(type: nil, format: nil) @type = type @format = format end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
9 10 11 |
# File 'lib/eazypi/schema/primitive.rb', line 9 def format @format end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/eazypi/schema/primitive.rb', line 9 def type @type end |
Instance Method Details
#==(other) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/eazypi/schema/primitive.rb', line 25 def ==(other) return false unless other.is_a?(Primitive) type == other.type && format == other.format end |
#collect_components(**_kwargs) ⇒ Object
16 |
# File 'lib/eazypi/schema/primitive.rb', line 16 def collect_components(**_kwargs); end |
#to_openapi_spec ⇒ Object
18 19 20 21 22 23 |
# File 'lib/eazypi/schema/primitive.rb', line 18 def to_openapi_spec { "type" => type, "format" => format }.compact end |