Class: Html2rss::Configuration
- Inherits:
-
Object
- Object
- Html2rss::Configuration
- Defined in:
- lib/html2rss/configuration.rb
Overview
Global configuration defaults for the Html2rss gem.
Constant Summary collapse
- VALID_LOG_LEVELS =
The valid symbol log levels.
%i[debug info warn error fatal unknown].freeze
Instance Attribute Summary collapse
-
#default_strategy ⇒ Symbol?
The default strategy name.
-
#headers ⇒ Hash, ...
The globally configured headers.
-
#log_level ⇒ Symbol, Integer
The current log level.
-
#logger ⇒ Object
The logger.
-
#logger_formatter ⇒ Proc?
The logger formatter.
-
#min_ttl ⇒ Integer?
The minimum TTL in minutes.
-
#stylesheets ⇒ Array<Hash>
The globally configured stylesheets.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initializes a new Configuration instance with defaults.
Constructor Details
#initialize ⇒ Configuration
Initializes a new Configuration instance with defaults.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/html2rss/configuration.rb', line 33 def initialize @logger_formatter = proc do |severity, datetime, _progname, msg| "#{datetime} [#{severity}] #{msg}\n" end @logger = Logger.new($stdout) @logger.formatter = @logger_formatter self.log_level = ENV.fetch('LOG_LEVEL', :warn) @headers = nil @default_strategy = nil @min_ttl = nil @stylesheets = [].freeze end |
Instance Attribute Details
#default_strategy ⇒ Symbol?
Returns the default strategy name.
23 24 25 |
# File 'lib/html2rss/configuration.rb', line 23 def default_strategy @default_strategy end |
#headers ⇒ Hash, ...
Returns the globally configured headers.
20 21 22 |
# File 'lib/html2rss/configuration.rb', line 20 def headers @headers end |
#log_level ⇒ Symbol, Integer
Returns the current log level.
17 18 19 |
# File 'lib/html2rss/configuration.rb', line 17 def log_level @log_level end |
#logger ⇒ Object
Returns the logger.
11 12 13 |
# File 'lib/html2rss/configuration.rb', line 11 def logger @logger end |
#logger_formatter ⇒ Proc?
Returns the logger formatter.
14 15 16 |
# File 'lib/html2rss/configuration.rb', line 14 def logger_formatter @logger_formatter end |
#min_ttl ⇒ Integer?
Returns the minimum TTL in minutes.
26 27 28 |
# File 'lib/html2rss/configuration.rb', line 26 def min_ttl @min_ttl end |
#stylesheets ⇒ Array<Hash>
Returns the globally configured stylesheets.
29 30 31 |
# File 'lib/html2rss/configuration.rb', line 29 def stylesheets @stylesheets end |