Class: OpenAPIGenerateTypeScriptFetch::ObjectSchemaProperty
- Inherits:
-
Object
- Object
- OpenAPIGenerateTypeScriptFetch::ObjectSchemaProperty
- Includes:
- Comparable
- Defined in:
- lib/openapi_generate_typescript_fetch/schema.rb
Overview
Contains info about a property of an object schema.
Instance Attribute Summary collapse
-
#additional ⇒ Object
readonly
Returns the value of attribute additional.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#req ⇒ Object
readonly
Returns the value of attribute req.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(type:, spec:, name: nil, req: false, pattern: false, additional: false) ⇒ ObjectSchemaProperty
constructor
A new instance of ObjectSchemaProperty.
- #to_s ⇒ Object
Constructor Details
#initialize(type:, spec:, name: nil, req: false, pattern: false, additional: false) ⇒ ObjectSchemaProperty
Returns a new instance of ObjectSchemaProperty.
16 17 18 19 20 21 22 23 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 16 def initialize(type:, spec:, name: nil, req: false, pattern: false, additional: false) @name = name @req = req @type = type @pattern = pattern @additional = additional @spec = spec end |
Instance Attribute Details
#additional ⇒ Object (readonly)
Returns the value of attribute additional.
14 15 16 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 14 def additional @additional end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 14 def name @name end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
14 15 16 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 14 def pattern @pattern end |
#req ⇒ Object (readonly)
Returns the value of attribute req.
14 15 16 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 14 def req @req end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
14 15 16 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 14 def spec @spec end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
14 15 16 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 14 def type @type end |
Instance Method Details
#<=>(other) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 25 def <=>(other) return -1 if !@name.nil? && other.name.nil? return 1 if @name.nil? && !other.name.nil? d = @name <=> other.name return d unless d.zero? d = @pattern <=> other.pattern return d unless d.zero? d = @additional <=> other.additional return d unless d.zero? d = @type <=> other.type return d unless d.zero? @spec <=> other.spec end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/openapi_generate_typescript_fetch/schema.rb', line 39 def to_s "ObjectSchemaProperty(name: #{@name}, req: #{@req}, type: #{@type}, pattern: #{@pattern}, additional: #{@additional}, spec: #{@spec})" end |