Class: Swaggard::Swagger::Type
- Inherits:
-
Object
- Object
- Swaggard::Swagger::Type
- Defined in:
- lib/swaggard/swagger/type.rb
Constant Summary collapse
- BASIC_TYPES =
{ 'integer' => { 'type' => 'integer', 'format' => 'int32' }, 'long' => { 'type' => 'integer', 'format' => 'int64' }, 'float' => { 'type' => 'number', 'format' => 'float' }, 'double' => { 'type' => 'number', 'format' => 'double' }, 'string' => { 'type' => 'string' }, 'byte' => { 'type' => 'string', 'format' => 'byte' }, 'binary' => { 'type' => 'string', 'format' => 'binary' }, 'boolean' => { 'type' => 'boolean' }, 'date' => { 'type' => 'string', 'format' => 'date' }, 'date-time' => { 'type' => 'string', 'format' => 'date-time' }, 'datetime' => { 'type' => 'string', 'format' => 'date-time' }, 'password' => { 'type' => 'string', 'format' => 'password' }, 'hash' => { 'type' => 'object' } }
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, is_array = false) ⇒ Type
constructor
A new instance of Type.
- #to_doc ⇒ Object
Constructor Details
#initialize(name, is_array = false) ⇒ Type
Returns a new instance of Type.
22 23 24 25 |
# File 'lib/swaggard/swagger/type.rb', line 22 def initialize(name, is_array = false) @name = name.to_s @is_array = is_array end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/swaggard/swagger/type.rb', line 20 def name @name end |
Instance Method Details
#to_doc ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/swaggard/swagger/type.rb', line 27 def to_doc if @is_array { 'type' => 'array', 'items' => type_tag_and_name } else type_tag_and_name end end |