Module: TagHelper

Defined in:
app/helpers/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#tag_for(text, hint: nil, tag: :li, type: []) ⇒ Object



2
3
4
5
6
7
# File 'app/helpers/tag_helper.rb', line 2

def tag_for(text, hint: nil, tag: :li, type: [])
  class_name = ['tag', *Array(type).map { |t| "tag--#{t}" }].join(' ')
  (tag, class: class_name) do
    (hint ? (:span, class: 'sr-only') { "#{hint}: " } : '') + text
  end
end