Class: Html2rss::Config::DynamicParams

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

Overview

Processes and applies dynamic parameter formatting in configuration values.

Defined Under Namespace

Classes: ParamsMissing

Class Method Summary collapse

Class Method Details

.call(value, params = {}, getter: nil, replace_missing_with: nil) ⇒ Object

Recursively traverses the given value and formats any strings containing placeholders with values from the provided params.

Parameters:

  • value (String, Hash, Enumerable, Object)

    value that may contain parameter placeholders

  • params (Hash) (defaults to: {})

    The parameters for substitution.

  • getter (Proc, nil) (defaults to: nil)

    Optional proc to retrieve a key’s value.

  • replace_missing_with (Object, nil) (defaults to: nil)

    Value to substitute if a key is missing.

Returns:

  • (Object)

    The processed value.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/html2rss/config/dynamic_params.rb', line 19

def call(value, params = {}, getter: nil, replace_missing_with: nil)
  case value
  when String
    from_string(value, params, getter:, replace_missing_with:)
  when Hash
    from_hash(value, params, getter:, replace_missing_with:)
  when Enumerable
    from_enumerable(value, params, getter:, replace_missing_with:)
  else
    value
  end
end