Class: Forms::Submission::Parameters
- Inherits:
-
Hash
- Object
- Hash
- Forms::Submission::Parameters
- Defined in:
- app/models/forms/submission/parameters.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cast(params) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/models/forms/submission/parameters.rb', line 11 def self.cast(params) case params when Array params.each_with_object({}) { |v, hash| hash[v[0]] = v[1] } else # Assume params behaves like a hash self[params] end end |
.from_mongo(params) ⇒ Object
21 22 23 |
# File 'app/models/forms/submission/parameters.rb', line 21 def self.from_mongo(params) cast(params) end |
Instance Method Details
#to_mongo ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/models/forms/submission/parameters.rb', line 3 def to_mongo result = [] each do |key, value| result << [key, value] end result end |