class Scriptster::Configuration
The configuration obejct used in the {Scriptster.configure} method.
@attr [String] name The name of the script to be displayed in the logs. @attr [Symbol] verbosity The minimum verbosity to of messages to be displayed. @attr [String, File, StringIO] file A log file that all messages will be written to. @attr [Boolean] timestamps Include timestamps in log messages. @attr [Symbol, Proc] colours Desired colour theme (either predefined or custom Proc).
@see ColourThemes
@attr [String] log_format
Template for each line in the logs
Attributes
colours[RW]
file[RW]
log_format[RW]
name[RW]
verbosity[RW]
Public Class Methods
new()
click to toggle source
# File lib/scriptster/configuration.rb, line 40 def initialize @name = File.basename($0) @verbosity = :verbose @file = nil @colours = :dark @log_format = "%{timestamp} %{name} %{type} %{message}" end
Public Instance Methods
apply()
click to toggle source
Put the settings from this object in effect.
This function will distribute the configuration to the appropriate objects and modules.
# File lib/scriptster/configuration.rb, line 52 def apply Logger.set_name @name if @name Logger.set_verbosity @verbosity if @verbosity Logger.set_file @file if @file Logger.set_format @log_format if @log_format if @colours.is_a? Proc @colours.call else ColourThemes.send @colours.to_sym end end