Module: Telegram::Bot::Initializers

Included in:
Botan, Client
Defined in:
lib/telegram/bot/initializers.rb

Instance Method Summary collapse

Instance Method Details

#by_id(_id) ⇒ Object



16
17
18
# File 'lib/telegram/bot/initializers.rb', line 16

def by_id(_id)
  raise 'Not implemented'
end

#wrap(input, **options) ⇒ Object

Accepts different options to initialize bot.



7
8
9
10
11
12
13
14
# File 'lib/telegram/bot/initializers.rb', line 7

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