Sha256: fbece24e0f8cc1a5f86fc1571c2c28e2cde12d19508c2ea582056f815a12d838

Contents?: true

Size: 463 Bytes

Versions: 1

Compression:

Stored size: 463 Bytes

Contents

# frozen_string_literal: true

module JSONAPIHelpers
  module Params
    class Fields
      attr_reader :fields_params

      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

      def to_h
        fields_params
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsonapi_helpers-0.2.0 lib/jsonapi_helpers/params/fields.rb