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

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


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

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 40

#development?Bool

Returns Yarr running in development environment.

Returns:

  • (Bool)

    Yarr running in development environment


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

def development?
  development == '1'
end

#nickString

Returns bot's nick.

Returns:

  • (String)

    bot's nick


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

#passwordString

Returns password for freenode.

Returns:

  • (String)

    password for freenode


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

#ruby_versionString

URLs.

Returns:

  • (String)

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


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

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


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

def test?
  test == '1'
end

#usernameString

Returns username for freenode.

Returns:

  • (String)

    username for freenode


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