Class: Gitlab::GrapeOpenapi::Models::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/grape_openapi/models/schema.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSchema

Returns a new instance of Schema.



10
11
12
# File 'lib/gitlab/grape_openapi/models/schema.rb', line 10

def initialize
  @properties = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *_args) ⇒ Object

Raises:

  • (NoMethodError)


14
15
16
17
18
# File 'lib/gitlab/grape_openapi/models/schema.rb', line 14

def method_missing(method_name, *_args)
  raise NoMethodError unless respond_to_missing?(method_name)

  properties[method_name]
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties.



8
9
10
# File 'lib/gitlab/grape_openapi/models/schema.rb', line 8

def properties
  @properties
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/gitlab/grape_openapi/models/schema.rb', line 8

def type
  @type
end

Instance Method Details

#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/gitlab/grape_openapi/models/schema.rb', line 20

def respond_to_missing?(method_name, _include_private = false)
  properties.key?(method_name)
end

#to_hObject



24
25
26
# File 'lib/gitlab/grape_openapi/models/schema.rb', line 24

def to_h
  build_schema_hash
end