Class: Paramoid::List
- Inherits:
-
Array
- Object
- Array
- Paramoid::List
- Defined in:
- lib/paramoid/list.rb
Instance Method Summary collapse
- #ensure_required_params!(params) ⇒ Object
- #to_defaults ⇒ Object
- #to_params ⇒ Object
- #transform_params!(params) ⇒ Object
Instance Method Details
#ensure_required_params!(params) ⇒ Object
19 20 21 22 23 |
# File 'lib/paramoid/list.rb', line 19 def ensure_required_params!(params) each do |params_data| params_data.ensure_required_params! params end end |
#to_defaults ⇒ Object
15 16 17 |
# File 'lib/paramoid/list.rb', line 15 def to_defaults inject({}) { |a, b| a.merge!(b.to_defaults) } end |
#to_params ⇒ Object
3 4 5 6 7 |
# File 'lib/paramoid/list.rb', line 3 def to_params list = reject(&:nested?).map(&:to_params) nested = select(&:nested?).inject({}) { |a, b| a.merge!(b.to_params) } nested.present? ? list << nested : list end |
#transform_params!(params) ⇒ Object
9 10 11 12 13 |
# File 'lib/paramoid/list.rb', line 9 def transform_params!(params) each do |params_data| params_data.transform_params! params end end |