Class: OpenAPISourceTools::ApiObjects::ServerVariableObject
- Inherits:
-
Object
- Object
- OpenAPISourceTools::ApiObjects::ServerVariableObject
- Includes:
- Comparable
- Defined in:
- lib/openapi/sourcetools/apiobjects.rb
Overview
Single server variable object.
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#enum ⇒ Object
readonly
Returns the value of attribute enum.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(name, variable_object) ⇒ ServerVariableObject
constructor
A new instance of ServerVariableObject.
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
#default ⇒ Object (readonly)
Returns the value of attribute default.
195 196 197 |
# File 'lib/openapi/sourcetools/apiobjects.rb', line 195 def default @default end |
#enum ⇒ Object (readonly)
Returns the value of attribute enum.
195 196 197 |
# File 'lib/openapi/sourcetools/apiobjects.rb', line 195 def enum @enum end |
#name ⇒ Object (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 |