Class: JSONAPIHelpers::Params::Fields
- Inherits:
-
Object
- Object
- JSONAPIHelpers::Params::Fields
- Defined in:
- lib/jsonapi_helpers/params/fields.rb
Instance Attribute Summary collapse
-
#fields_params ⇒ Object
readonly
Returns the value of attribute fields_params.
Instance Method Summary collapse
-
#initialize(fields_params) ⇒ Fields
constructor
A new instance of Fields.
- #to_h ⇒ Object
Constructor Details
#initialize(fields_params) ⇒ Fields
Returns a new instance of Fields.
8 9 10 11 12 13 14 15 |
# File 'lib/jsonapi_helpers/params/fields.rb', line 8 def initialize(fields_params) @fields_params = {} (fields_params || {}).each do |model_name, value| @fields_params[model_name] = value.split(',').map do |name| StringSupport.underscore(name.strip) end end end |
Instance Attribute Details
#fields_params ⇒ Object (readonly)
Returns the value of attribute fields_params.
6 7 8 |
# File 'lib/jsonapi_helpers/params/fields.rb', line 6 def fields_params @fields_params end |
Instance Method Details
#to_h ⇒ Object
17 18 19 |
# File 'lib/jsonapi_helpers/params/fields.rb', line 17 def to_h fields_params end |