Sha256: e6a672f3032e92c9efc248f6678a5baec05597221baf2382bbf42efe1f0c91b6

Contents?: true

Size: 533 Bytes

Versions: 9

Compression:

Stored size: 533 Bytes

Contents

require 'active_support/core_ext/hash/keys'

module Telegram
  module Bot
    module Initializers
      # Accepts different options to initialize bot.
      def wrap(input, **options)
        case input
        when Symbol then by_id(input) or raise "#{name} #{input.inspect} not configured"
        when self   then input
        when Hash   then new(**input.symbolize_keys, **options)
        else        new(input, **options)
        end
      end

      def by_id(_id)
        raise 'Not implemented'
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
telegram-bot-0.14.4 lib/telegram/bot/initializers.rb
telegram-bot-0.14.3 lib/telegram/bot/initializers.rb
telegram-bot-0.14.2 lib/telegram/bot/initializers.rb
telegram-bot-0.14.1 lib/telegram/bot/initializers.rb
telegram-bot-0.14.0 lib/telegram/bot/initializers.rb
telegram-bot-0.13.1 lib/telegram/bot/initializers.rb
telegram-bot-0.13.0 lib/telegram/bot/initializers.rb
telegram-bot-0.12.4 lib/telegram/bot/initializers.rb
telegram-bot-0.12.3 lib/telegram/bot/initializers.rb