Class: SwaggerApi::Components
- Inherits:
-
Object
- Object
- SwaggerApi::Components
- Includes:
- ActiveAttr::Model
- Defined in:
- lib/swagger_api/components.rb
Instance Attribute Summary collapse
-
#controllers ⇒ Object
Returns the value of attribute controllers.
Instance Method Summary collapse
Instance Attribute Details
#controllers ⇒ Object
Returns the value of attribute controllers.
4 5 6 |
# File 'lib/swagger_api/components.rb', line 4 def controllers @controllers end |
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/swagger_api/components.rb', line 6 def create return @components unless @components.nil? @components = {} controllers.each do |controller| if controller.custom_model_file.nil? @components[controller.model] = ComponentSchema.new(controller: controller).create else @components.merge!(custom_json(controller.custom_model_file)) end end @components end |
#custom_json(custom_model_file) ⇒ Object
19 20 21 22 |
# File 'lib/swagger_api/components.rb', line 19 def custom_json(custom_model_file) file = File.read(custom_model_file) JSON.parse(file) end |