Class: Yarr::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/yarr/configuration.rb

Overview

Export environment variables to change the set up. Supported variables:

- YARR_TEST => use test database
- YARR_DEVELOPMENT => output verbose debug info

configuration file can be in config/yarr.yml

Constant Summary collapse

DEFAULT_CONFIG =

Default configuration settings

AppConfiguration.new do
  config_file_name 'yarr.yml'
  base_local_path CONFIG_PATH
  base_global_path CONFIG_PATH
  prefix 'yarr'
end

Instance Method Summary collapse

Constructor Details

#initialize(config = DEFAULT_CONFIG) ⇒ Configuration

Configuration including environment variables and configuration files

Parameters:

  • config (AppConfiguration::Config) (defaults to: DEFAULT_CONFIG)

    DEFAULT_CONFIG is good in almost all cases


28
29
30
# File 'lib/yarr/configuration.rb', line 28

def initialize(config = DEFAULT_CONFIG)
  @config = config
end

Instance Method Details

#channels[String]

Returns array of channel names where the bot will be active.

Returns:

  • ([String])

    array of channel names where the bot will be active


# File 'lib/yarr/configuration.rb', line 41

#development?Bool

Returns Yarr running in development environment.

Returns:

  • (Bool)

    Yarr running in development environment


65
66
67
# File 'lib/yarr/configuration.rb', line 65

def development?
  development == '1'
end

#nickString

Returns bot's nick.

Returns:

  • (String)

    bot's nick


# File 'lib/yarr/configuration.rb', line 38

#passwordString

Returns password for freenode.

Returns:

  • (String)

    password for freenode


# File 'lib/yarr/configuration.rb', line 35

#ruby_versionString

URLs.

Returns:

  • (String)

    the ruby version that can be inserted in the ruby-doc


55
56
57
# File 'lib/yarr/configuration.rb', line 55

def ruby_version
  @config.public_send(__method__) || '2.6'
end

#test?Bool

Returns Yarr running in test environment.

Returns:

  • (Bool)

    Yarr running in test environment


60
61
62
# File 'lib/yarr/configuration.rb', line 60

def test?
  test == '1'
end

#usernameString

Returns username for freenode.

Returns:

  • (String)

    username for freenode


# File 'lib/yarr/configuration.rb', line 32