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.0.0 lib/quby/answers/services/filters_answer_value.rb
quby-4.0.4 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.0.pre4 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.0.pre3 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.0.pre2 lib/quby/answers/services/filters_answer_value.rb
quby-5.0.0.pre1 lib/quby/answers/services/filters_answer_value.rb
quby-4.0.3 lib/quby/answers/services/filters_answer_value.rb
quby-4.0.2 lib/quby/answers/services/filters_answer_value.rb
quby-4.0.1 lib/quby/answers/services/filters_answer_value.rb
quby-4.0.0 lib/quby/answers/services/filters_answer_value.rb
quby-3.2.2 lib/quby/answers/services/filters_answer_value.rb
quby-3.2.1 lib/quby/answers/services/filters_answer_value.rb
quby-3.2.0 lib/quby/answers/services/filters_answer_value.rb
quby-3.2.0.pre.pre1 lib/quby/answers/services/filters_answer_value.rb