Welcome to mirror list, hosted at ThFree Co, Russian Federation.

hash_of_integer_values.rb « types « validations « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 05821acfad532fd19dae2a20b21d375cd71553ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module API
  module Validations
    module Types
      class HashOfIntegerValues
        def self.coerce
          lambda do |value|
            case value
            when Hash
              value.transform_values(&:to_i)
            else
              value
            end
          end
        end
      end
    end
  end
end