Class: ReeText::SafeJoin

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_text/package/ree_text/functions/safe_join.rb

Constant Summary collapse

DEFAULTS =
{
  sep: "$"
}

Instance Method Summary collapse

Instance Method Details

#call(array, **opts) ⇒ Object



30
31
32
33
34
35
# File 'lib/ree_lib/packages/ree_text/package/ree_text/functions/safe_join.rb', line 30

def call(array, **opts)
  options = DEFAULTS.merge(opts)
  sep = escape_html(options[:sep])

  array.flatten.map { |i| escape_html(i) }.join(sep)
end