зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
@@ -15,6 +15,7 @@ Style/DotPosition: {EnforcedStyle: trailing}
|
||||
Style/FirstParameterIndentation: {EnforcedStyle: consistent}
|
||||
Style/IfUnlessModifier: {Enabled: false}
|
||||
Style/ModuleFunction: {Enabled: false}
|
||||
Style/MultilineMethodCallIndentation: {EnforcedStyle: indented}
|
||||
Style/MultilineOperationIndentation: {EnforcedStyle: indented}
|
||||
Style/NestedParenthesizedCalls: {Enabled: false}
|
||||
Style/PredicateName: {Enabled: false}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# 0.11.2
|
||||
|
||||
- Rails 5.1 deep symbolized secrets support.
|
||||
|
||||
# 0.11.1
|
||||
|
||||
# Fixed poller for typed response.
|
||||
- Fixed poller for typed response.
|
||||
|
||||
# 0.11.0
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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
|
||||
module Bot
|
||||
@@ -48,9 +49,10 @@ module Telegram
|
||||
def bots_config
|
||||
@bots_config ||=
|
||||
if defined?(Rails.application)
|
||||
telegram_config = Rails.application.secrets[:telegram] || {}
|
||||
(telegram_config['bots'] || {}).symbolize_keys.tap do |config|
|
||||
default = telegram_config['bot']
|
||||
secrets = Rails.application.secrets.
|
||||
fetch(:telegram, {}).with_indifferent_access
|
||||
secrets.fetch(:bots, {}).symbolize_keys.tap do |config|
|
||||
default = secrets[:bot]
|
||||
config[:default] = default if default
|
||||
end
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Telegram
|
||||
module Bot
|
||||
VERSION = '0.11.1'.freeze
|
||||
VERSION = '0.11.2'.freeze
|
||||
|
||||
def self.gem_version
|
||||
Gem::Version.new VERSION
|
||||
|
||||
@@ -87,6 +87,12 @@ RSpec.describe Telegram::Bot::ConfigMethods do
|
||||
end
|
||||
it { should include default: config[:bot] }
|
||||
it { should include config[:bots] }
|
||||
|
||||
context 'on rails >5.1 (deep symbolized keys)' do
|
||||
let(:secrets) { {telegram: config.deep_symbolize_keys} }
|
||||
it { should include default: config[:bot] }
|
||||
it { should include config[:bots] }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Ссылка в новой задаче
Block a user