Class: Swaggard::Swagger::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/swaggard/swagger/property.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(yard_object) ⇒ Property

Returns a new instance of Property.



9
10
11
12
13
# File 'lib/swaggard/swagger/property.rb', line 9

def initialize(yard_object)
  @id = yard_object.name
  @type = Type.new(yard_object.types)
  @description = yard_object.text
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



7
8
9
# File 'lib/swaggard/swagger/property.rb', line 7

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/swaggard/swagger/property.rb', line 7

def id
  @id
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/swaggard/swagger/property.rb', line 7

def type
  @type
end

Instance Method Details

#to_docObject



15
16
17
18
19
# File 'lib/swaggard/swagger/property.rb', line 15

def to_doc
  result = @type.to_doc
  result['description'] = @description if @description
  result
end