Sha256: 0091de43946198dd9bfa427d85018662feeabaf41134a76558d55f50dfd954a6

Contents?: true

Size: 570 Bytes

Versions: 34

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

module Quby
  module Answers
    module Services
      class FiltersAnswerValue
        def initialize(questionnaire)
          @questionnaire = questionnaire
        end

        def filter(attributes)
          valid_attribute_keys.each_with_object({}) do |key, obj|
            obj[key] = attributes.fetch(key, nil)
          end
        end

        private

        def valid_attribute_keys
          @valid_attribute_keys ||= %w(aborted) +
              @questionnaire.answer_keys.map(&:to_s)
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
quby-5.6.6 lib/quby/answers/services/filters_answer_value.rb
quby-5.6.5 lib/quby/answers/services/filters_answer_value.rb
quby-5.6.3 lib/quby/answers/services/filters_answer_value.rb
quby-5.6.2 lib/quby/answers/services/filters_answer_value.rb
quby-5.6.1 lib/quby/answers/services/filters_answer_value.rb
quby-5.6.0 lib/quby/answers/services/filters_answer_value.rb
quby-5.5.0 lib/quby/answers/services/filters_answer_value.rb
quby-5.4.0 lib/quby/answers/services/filters_answer_value.rb
quby-5.3.1 lib/quby/answers/services/filters_answer_value.rb
quby-5.3.0 lib/quby/answers/services/filters_answer_value.rb
quby-5.2.0 lib/quby/answers/services/filters_answer_value.rb
quby-5.1.3 lib/quby/answers/services/filters_answer_value.rb
quby-5.1.2 lib/quby/answers/services/filters_answer_value.rb
quby-5.1.1 lib/quby/answers/services/filters_answer_value.rb
quby-5.1.0 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.5 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.4 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.3 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.2 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.1 lib/quby/answers/services/filters_answer_value.rb