Class: OpenAPISourceTools::ApiObjects::ServerVariableObject

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/openapi/sourcetools/apiobjects.rb

Overview

Single server variable object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, variable_object) ⇒ ServerVariableObject

Returns a new instance of ServerVariableObject.



197
198
199
200
201
# File 'lib/openapi/sourcetools/apiobjects.rb', line 197

def initialize(name, variable_object)
  @name = name
  @default = variable_object['default']
  @enum = (variable_object['enum'] || []).sort!
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



195
196
197
# File 'lib/openapi/sourcetools/apiobjects.rb', line 195

def default
  @default
end

#enumObject (readonly)

Returns the value of attribute enum.



195
196
197
# File 'lib/openapi/sourcetools/apiobjects.rb', line 195

def enum
  @enum
end

#nameObject (readonly)

Returns the value of attribute name.



195
196
197
# File 'lib/openapi/sourcetools/apiobjects.rb', line 195

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



203
204
205
206
207
208
209
# File 'lib/openapi/sourcetools/apiobjects.rb', line 203

def <=>(other)
  d = @name <=> other.name
  return d unless d.zero?
  d = @default <=> other.default
  return d unless d.zero?
  @enum <=> other.enum
end