Class: Swagger::Grape::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-swagger/grape/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Type

Returns a new instance of Type.



9
10
11
12
# File 'lib/ruby-swagger/grape/type.rb', line 9

def initialize(type)
  @type = type.to_s || 'String'
  @swagger_type = {}
end

Instance Attribute Details

#discovered_typesObject (readonly)

needed?



7
8
9
# File 'lib/ruby-swagger/grape/type.rb', line 7

def discovered_types
  @discovered_types
end

Instance Method Details

#sub_typesObject



18
19
20
# File 'lib/ruby-swagger/grape/type.rb', line 18

def sub_types
  Swagger::Grape::Entity.new(@type).sub_types
end

#to_swagger(with_definition = true) ⇒ Object



14
15
16
# File 'lib/ruby-swagger/grape/type.rb', line 14

def to_swagger(with_definition = true)
  translate(@type, with_definition)
end