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



14
15
16
# File 'lib/telegram/bot/initializers.rb', line 14

def by_id(_id)
  raise 'Not implemented'
end

#wrap(input, **options) ⇒ Object

Accepts different options to initialize bot.



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

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