Class: WeakSwaggerParameters::Definitions::ModelProperty
- Inherits:
-
Object
- Object
- WeakSwaggerParameters::Definitions::ModelProperty
- Defined in:
- lib/weak_swagger_parameters/definitions/model_property.rb
Instance Method Summary collapse
- #apply_docs(parent_node) ⇒ Object
- #apply_validations(parent_node) ⇒ Object
-
#initialize(name, description, model_class) ⇒ ModelProperty
constructor
A new instance of ModelProperty.
Constructor Details
#initialize(name, description, model_class) ⇒ ModelProperty
Returns a new instance of ModelProperty.
6 7 8 9 10 |
# File 'lib/weak_swagger_parameters/definitions/model_property.rb', line 6 def initialize(name, description, model_class) @name = name @description = description @model_class = model_class end |
Instance Method Details
#apply_docs(parent_node) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/weak_swagger_parameters/definitions/model_property.rb', line 23 def apply_docs(parent_node) name = @name description = @description model_class = @model_class parent_node.instance_eval do property name, description: description, type: :object do key :'$ref', model_class.docs_model_name end end end |
#apply_validations(parent_node) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/weak_swagger_parameters/definitions/model_property.rb', line 12 def apply_validations(parent_node) name = @name node = @model_class.wsp_node parent_node.instance_eval do hash name, strong: true do node.apply_validations(parent_node) end end end |