Module: Fronde::Config::Filters

Defined in:
lib/fronde/config/helpers.rb

Overview

Filter for liquid templates

Instance Method Summary collapse

Instance Method Details

#cast_lisp_value(value, key) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fronde/config/helpers.rb', line 41

def cast_lisp_value(value, key)
  return 't' if value.is_a?(TrueClass)
  return 'nil' if value.nil? || value.is_a?(FalseClass)

  value = value.strip
  lisp_keywords = ['t', 'nil', '1', '-1', '0']
  if key.end_with?('-function') || lisp_keywords.include?(value)
    return value
  end

  value.gsub!('"', '\"')
  %("#{value}")
end

#md5(value) ⇒ Object



55
56
57
# File 'lib/fronde/config/helpers.rb', line 55

def md5(value)
  Digest::MD5.hexdigest(value)
end