Sha256: 30f70089736ca6bffa9d37634d56e0bf04df21240ddb8f99a3156473c396aa2f

Contents?: true

Size: 614 Bytes

Versions: 8

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

module BingAdsRubySdk
  module Postprocessors
    class CastLongArrays

      def initialize(params)
        @params = params
      end

      def call
        process(@params)
      end

      private

      def process(obj)
        return unless obj.is_a?(Hash)

        obj.each do |k, v|
          case v
          when Hash
            if v[:long].is_a?(Array)
              obj[k] = v[:long].map(&:to_i)
            else
              process(v)
            end
          when Array
            v.each {|elt| process(elt) }
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bing_ads_ruby_sdk-1.3.4 lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb
bing_ads_ruby_sdk-1.3.3 lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb
bing_ads_ruby_sdk-1.3.2 lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb
bing_ads_ruby_sdk-1.3.1 lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb
bing_ads_ruby_sdk-1.3.0 lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb
bing_ads_ruby_sdk-1.2.0 lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb
bing_ads_ruby_sdk-1.1.1 lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb
bing_ads_ruby_sdk-1.0.0 lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb