1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-08-28 15:26:18 +03:00

Avoid Hash#transform_values. Fixes #63

Этот коммит содержится в:
Max Melentiev
2018-02-21 19:49:09 +03:00
родитель c86b2ef09b
Коммит 9af6de8d36
2 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@@ -1,5 +1,4 @@
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/transform_values'
require 'active_support/core_ext/hash/indifferent_access'
module Telegram
@@ -43,7 +42,7 @@ module Telegram
# Hash of botan clients made from #bots.
def botans
@botans ||= bots.transform_values(&:botan)
@botans ||= bots.map { |k, v| [k, v.botan] }.to_h
end
# Returns config for .bots method. By default uses `telegram['bots']` section

Просмотреть файл

@@ -35,7 +35,7 @@ RSpec.shared_context 'telegram/bot/updates_controller' do
def deep_stringify(input)
case input
when Array then input.map(&method(__callee__))
when Hash then input.transform_keys(&:to_s).transform_values(&method(__callee__))
when Hash then input.map { |k, v| [k.to_s, deep_stringify(v)] }.to_h
else input
end
end