Class: OAPI::OpenAPI::V30::Serializers::Ruby::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/oapi/open_api/v30/serializers/ruby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Wrapper

Returns a new instance of Wrapper.



43
# File 'lib/oapi/open_api/v30/serializers/ruby.rb', line 43

def initialize(object) = @object = object

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



41
42
43
# File 'lib/oapi/open_api/v30/serializers/ruby.rb', line 41

def object
  @object
end

Instance Method Details

#bindObject



45
# File 'lib/oapi/open_api/v30/serializers/ruby.rb', line 45

def bind = binding

#serialize(node) ⇒ Object



47
# File 'lib/oapi/open_api/v30/serializers/ruby.rb', line 47

def serialize(node) = OAPI::OpenAPI::V30::Serializers::Ruby.serialize(node)

#serialize_if_supported(node) ⇒ Object



49
# File 'lib/oapi/open_api/v30/serializers/ruby.rb', line 49

def serialize_if_supported(node) = OAPI::OpenAPI::V30::Serializers::Ruby.serialize_if_supported(node)

#supported?(node) ⇒ Boolean

Returns:

  • (Boolean)


48
# File 'lib/oapi/open_api/v30/serializers/ruby.rb', line 48

def supported?(node) = OAPI::OpenAPI::V30::Serializers::Ruby.supported?(node)

#value_to_ruby(value) ⇒ Object

Raises:

  • (ArgumentError)


51
52
53
54
55
56
# File 'lib/oapi/open_api/v30/serializers/ruby.rb', line 51

def value_to_ruby(value)
  return value.inspect if [Numeric, String, Array, TrueClass, FalseClass].any? { value.is_a?(_1) }
  return "(#{value.inspect})" if value.is_a?(Hash)

  raise ArgumentError, "value: #{value}"
end