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.



301
302
303
304
305
# File 'lib/openapi/sourcetools/apiobjects.rb', line 301

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.



299
300
301
# File 'lib/openapi/sourcetools/apiobjects.rb', line 299

def default
  @default
end

#enumObject (readonly)

Returns the value of attribute enum.



299
300
301
# File 'lib/openapi/sourcetools/apiobjects.rb', line 299

def enum
  @enum
end

#nameObject (readonly)

Returns the value of attribute name.



299
300
301
# File 'lib/openapi/sourcetools/apiobjects.rb', line 299

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



307
308
309
310
311
312
313
# File 'lib/openapi/sourcetools/apiobjects.rb', line 307

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