Sha256: 760e04620ff994375686b0d1cfc896e2ce37a9b9514be9c3bdb81434d545bf71

Contents?: true

Size: 516 Bytes

Versions: 3

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true

module Slack
  module Web
    module Api
      module Options
        def encode_options_as_json(options, keys)
          encoded_options = options.slice(*keys).transform_values do |value|
            encode_json(value)
          end
          options.merge(encoded_options)
        end

        private

        def encode_json(value)
          if value.is_a?(String)
            value
          else
            JSON.dump(value)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-ruby-client-2.4.0 lib/slack/web/api/options.rb
slack-ruby-client-2.3.0 lib/slack/web/api/options.rb
slack-ruby-client-2.2.0 lib/slack/web/api/options.rb