Class: ActiveSwagger::Params
- Inherits:
-
Object
- Object
- ActiveSwagger::Params
- Defined in:
- lib/active_swagger/params.rb
Instance Attribute Summary collapse
-
#properties ⇒ Object
Returns the value of attribute properties.
Instance Method Summary collapse
-
#initialize(properties) ⇒ Params
constructor
A new instance of Params.
- #mapping(key, value) ⇒ Object
- #to_strong_params ⇒ Object
Constructor Details
#initialize(properties) ⇒ Params
Returns a new instance of Params.
7 8 9 |
# File 'lib/active_swagger/params.rb', line 7 def initialize(properties) @properties = properties end |
Instance Attribute Details
#properties ⇒ Object
Returns the value of attribute properties.
5 6 7 |
# File 'lib/active_swagger/params.rb', line 5 def properties @properties end |
Instance Method Details
#mapping(key, value) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/active_swagger/params.rb', line 11 def mapping(key, value) case value[:type] when :array { key => [] } when :object { key => {} } else key end end |
#to_strong_params ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/active_swagger/params.rb', line 22 def to_strong_params params = [] properties.each_pair do |key, value| params.push(mapping(key, value)) end params end |