Class: Hg::Assistant::Bot

Inherits:
Object
  • Object
show all
Extended by:
Dry::Configurable
Defined in:
lib/hg/assistant/bot.rb

Class Method Summary collapse

Class Method Details

.configure {|config| ... } ⇒ Object

Yields:

  • (config)


16
17
18
# File 'lib/hg/assistant/bot.rb', line 16

def configure(&block)
  yield config
end

.routerClass

Returns The bot's router class.

Returns:

  • (Class)

    The bot's router class.



21
22
23
24
25
# File 'lib/hg/assistant/bot.rb', line 21

def router
  config.router_class ||= const_get(:Router)
rescue LoadError
  raise NoRouterClassExistsError.new
end

.user_classObject



27
28
29
30
# File 'lib/hg/assistant/bot.rb', line 27

def user_class
  # TODO: Ensure config returns default user_class
  config.user_class || Kernel.const_get(:User)
end

.user_context_fieldObject



32
33
34
# File 'lib/hg/assistant/bot.rb', line 32

def user_context_field
  config.user_context_field || :context
end