Class: Stockboy::Configuration

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

Overview

Global Stockboy configuration options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize { ... } ⇒ Configuration

Initialize a set of global configuration options

Yields:

  • self for configuration



41
42
43
44
45
46
47
# File 'lib/stockboy/configuration.rb', line 41

def initialize
  @template_load_paths = []
  @logger = Logger.new(STDOUT)
  @tmp_dir = Dir.tmpdir
  @translation_error_handler = ->(error) { nil }
  yield self if block_given?
end

Instance Attribute Details

#loggerLogger

Default logger

Returns:

  • (Logger)


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

def logger
  @logger
end

#template_load_pathsArray<String>

Directories where Stockboy job template files can be found.

Needs to be configured with your own paths if running standalone. When running with Rails, includes config/stockboy_jobs by default.

Returns:

  • (Array<String>)


16
17
18
# File 'lib/stockboy/configuration.rb', line 16

def template_load_paths
  @template_load_paths
end

#tmp_dirString

Path for storing tempfiles during processing

Returns:

  • (String)


22
23
24
# File 'lib/stockboy/configuration.rb', line 22

def tmp_dir
  @tmp_dir
end

#translation_error_handlerObject

To allow inspection when tranlastion error occurs

By default returns nil on error but can be overridden



33
34
35
# File 'lib/stockboy/configuration.rb', line 33

def translation_error_handler
  @translation_error_handler
end