Class: Html2rss::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_strategySymbol?

Returns the default strategy name.

Returns:

  • (Symbol, nil)

    the default strategy name



23
24
25
# File 'lib/html2rss/configuration.rb', line 23

def default_strategy
  @default_strategy
end

#headersHash, ...

Returns the globally configured headers.

Returns:

  • (Hash, Proc, nil)

    the globally configured headers



20
21
22
# File 'lib/html2rss/configuration.rb', line 20

def headers
  @headers
end

#log_levelSymbol, Integer

Returns the current log level.

Returns:

  • (Symbol, Integer)

    the current log level



17
18
19
# File 'lib/html2rss/configuration.rb', line 17

def log_level
  @log_level
end

#loggerObject

Returns the logger.

Returns:

  • (Object)

    the logger



11
12
13
# File 'lib/html2rss/configuration.rb', line 11

def logger
  @logger
end

#logger_formatterProc?

Returns the logger formatter.

Returns:

  • (Proc, nil)

    the logger formatter



14
15
16
# File 'lib/html2rss/configuration.rb', line 14

def logger_formatter
  @logger_formatter
end

#min_ttlInteger?

Returns the minimum TTL in minutes.

Returns:

  • (Integer, nil)

    the minimum TTL in minutes



26
27
28
# File 'lib/html2rss/configuration.rb', line 26

def min_ttl
  @min_ttl
end

#stylesheetsArray<Hash>

Returns the globally configured stylesheets.

Returns:

  • (Array<Hash>)

    the globally configured stylesheets



29
30
31
# File 'lib/html2rss/configuration.rb', line 29

def stylesheets
  @stylesheets
end