Class: Html2rss::Config::Preparer

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/config.rb

Overview

Normalizes raw config input before validation.

Instance Method Summary collapse

Instance Method Details

#call(config) ⇒ Hash{Symbol => Object}

Returns config with defaults applied.

Parameters:

  • config (Hash{Symbol => Object})

    raw config input

Returns:

  • (Hash{Symbol => Object})

    config with defaults applied



257
258
259
260
261
262
263
264
265
# File 'lib/html2rss/config.rb', line 257

def call(config)
  config = config.dup if config.frozen?

  config = apply_default_config(config)
  config = apply_default_selectors_config(config) if config[:selectors]
  config = apply_default_auto_source_config(config) if config[:auto_source]

  config
end