Module: RubyView::Helpers::Tag
- Included in:
- Context
- Defined in:
- lib/rubyview/helpers/tag.rb
Instance Method Summary collapse
- #format_html_opts(**html_opts) ⇒ Object
- #generate_tag(name, content, **html_opts) ⇒ Object
- #h1(text, **html_opts) ⇒ Object
Instance Method Details
#format_html_opts(**html_opts) ⇒ Object
13 14 15 16 |
# File 'lib/rubyview/helpers/tag.rb', line 13 def format_html_opts(**html_opts) return "" if html_opts.empty? html_opts.map { |k, v| [k,v].join("=") }.join(" ") end |
#generate_tag(name, content, **html_opts) ⇒ Object
8 9 10 11 |
# File 'lib/rubyview/helpers/tag.rb', line 8 def generate_tag(name, content, **html_opts) formatted_html_opts = format_html_opts(**html_opts) "<#{name}#{formatted_html_opts}>#{content}</#{name}>" end |
#h1(text, **html_opts) ⇒ Object
4 5 6 |
# File 'lib/rubyview/helpers/tag.rb', line 4 def h1(text, **html_opts) generate_tag(:h1, text, **html_opts) end |