зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
Avoid Hash#transform_values. Fixes #63
Этот коммит содержится в:
@@ -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
|
||||
|
||||
Ссылка в новой задаче
Block a user