Class: OAPI::OpenAPI::V30::Serializers::Serializer
- Inherits:
-
Object
- Object
- OAPI::OpenAPI::V30::Serializers::Serializer
- Defined in:
- lib/oapi/open_api/v30/serializers/serializer.rb
Constant Summary collapse
- FUNCTIONS =
order matters
{ # order matters OAPI::Ref => "serialize_ref", OAPI::Schema => "serialize_schema", OAPI::OpenAPI::V30::Definition => "serialize_definition", OAPI::Types::Map => "serialize_map", OAPI::Types::Array => "serialize_array", OAPI::Types::Object => "serialize_object" }.freeze
Class Method Summary collapse
- .serialize(node) ⇒ Object
- .serialize_if_supported(node) ⇒ Object
- .serializer(node) ⇒ Object
- .supported?(node) ⇒ Boolean
Class Method Details
.serialize(node) ⇒ Object
14 |
# File 'lib/oapi/open_api/v30/serializers/serializer.rb', line 14 def serialize(node) = new.send(serializer(node), node) |
.serialize_if_supported(node) ⇒ Object
17 |
# File 'lib/oapi/open_api/v30/serializers/serializer.rb', line 17 def serialize_if_supported(node) = supported?(node) ? serialize(node) : node |
.serializer(node) ⇒ Object
15 |
# File 'lib/oapi/open_api/v30/serializers/serializer.rb', line 15 def serializer(node) = FUNCTIONS.find { |k, _| node.is_a?(k) }&.at(1) |
.supported?(node) ⇒ Boolean
16 |
# File 'lib/oapi/open_api/v30/serializers/serializer.rb', line 16 def supported?(node) = !serializer(node).nil? |