Class: Swagger::Data::Schema
- Inherits:
-
Object
- Object
- Object
- Swagger::Data::Schema
show all
- Defined in:
- lib/ruby-swagger/data/schema.rb
Overview
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Object
attr_swagger, #bulk_set, #swagger_attributes, #to_json, #to_swagger, #to_yaml
Instance Attribute Details
Returns the value of attribute ref.
17
18
19
|
# File 'lib/ruby-swagger/data/schema.rb', line 17
def ref
@ref
end
|
Class Method Details
.parse(schema) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/ruby-swagger/data/schema.rb', line 19
def self.parse(schema)
return nil if schema.nil?
sc = Swagger::Data::Schema.new.bulk_set(schema)
sc.ref= schema['$ref']
sc
end
|
Instance Method Details
#[](attrib) ⇒ Object
57
58
59
|
# File 'lib/ruby-swagger/data/schema.rb', line 57
def [](attrib)
self.send("#{attrib}")
end
|
#[]=(attrib, value) ⇒ Object
53
54
55
|
# File 'lib/ruby-swagger/data/schema.rb', line 53
def []=(attrib, value)
self.send("#{attrib}=", value)
end
|
#as_swagger ⇒ Object
61
62
63
64
65
|
# File 'lib/ruby-swagger/data/schema.rb', line 61
def as_swagger
res = super
res['$ref'] = @ref if @ref
res
end
|
#externalDocs=(new_doc) ⇒ Object
#xml=(new_xml) ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/ruby-swagger/data/schema.rb', line 43
def xml=(new_xml)
return nil unless new_xml
if !new_xml.is_a?(Swagger::Data::XMLObject)
new_xml = Swagger::Data::XMLObject.parse(new_xml)
end
@xml = new_xml
end
|