Sha256: 82a06ebda7825a5861c7917a5e338eb4758f11f5a2f03fe6a420166287cd5ad2

Contents?: true

Size: 590 Bytes

Versions: 3

Compression:

Stored size: 590 Bytes

Contents

module SnippetsHelper

  # Renders a snippet on the page
  #
  #   snippet 'address'
  #   # => "54B Downham Road"
  #
  # @param  [String]     key                         Snippet key to lookup
  # @return [String]
  #
  def snippet(key = nil)
    Snippet.find_for_key(key)
  end

  # Renders a localized snippet for the current locale
  #
  #   localized_snippet 'address'
  #   # => "54B Downham Road"
  #
  # @param  [String]     key                         Snippet key to lookup
  # @return [String]
  #
  def localized_snippet(key = nil)
    snippet("#{I18n.locale}.#{key}")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slices-2.0.2 app/helpers/snippets_helper.rb
slices-2.0.1 app/helpers/snippets_helper.rb
slices-2.0.0 app/helpers/snippets_helper.rb