Class: Wallaby::LinkOptionsNormalizer

Inherits:
Object
  • Object
show all
Defined in:
lib/services/wallaby/link_options_normalizer.rb

Overview

Link renderer

Class Method Summary collapse

Class Method Details

.normalize(html_options, block, defaults) ⇒ Array<Hash, Proc>

Normalize options for ‘link_to` to use

Parameters:

  • html_options (Hash)

    HTML options

  • block (Proc)

    a block

  • defaults (Hash)

Returns:

  • (Array<Hash, Proc>)

    html_options and the block



11
12
13
14
15
16
17
18
# File 'lib/services/wallaby/link_options_normalizer.rb', line 11

def self.normalize(html_options, block, defaults)
  html_options = Utils.clone html_options
  block ||= defaults[:block]
  html_options[:title] ||= defaults[:block].call
  # allow empty class to be set
  html_options[:class] = defaults[:class] if !html_options.key?(:class) && defaults[:class]
  [html_options, block]
end