Module: Card::Bootstrap::ComponentKlass
- Included in:
- Component
- Defined in:
- lib/card/bootstrap/component_klass.rb
Overview
class methods for Bootstrap::Component
Instance Method Summary collapse
-
#def_div_method(name, html_class, opts = {}, &tag_block) ⇒ Object
Like def_tag_method but always generates a div tag The tag option is not available.
-
#def_tag_method(method_name, html_class, tag_opts = {}, &tag_opts_block) ⇒ Object
Defines a method that generates a html tag.
- #render(format, *args, &block) ⇒ Object
Instance Method Details
#def_div_method(name, html_class, opts = {}, &tag_block) ⇒ Object
Like def_tag_method but always generates a div tag The tag option is not available
11 12 13 |
# File 'lib/card/bootstrap/component_klass.rb', line 11 def def_div_method name, html_class, opts={}, &tag_block def_tag_method name, html_class, opts.merge(tag: :div), &tag_block end |
#def_tag_method(method_name, html_class, tag_opts = {}, &tag_opts_block) ⇒ Object
Defines a method that generates a html tag
26 27 28 29 30 31 32 33 34 |
# File 'lib/card/bootstrap/component_klass.rb', line 26 def def_tag_method method_name, html_class, tag_opts={}, &tag_opts_block tag = tag_opts.delete(:tag) || method_name define_method method_name do |*args, &content_block| @html.tag! tag, tag_method_opts(args, html_class, tag_opts, &tag_opts_block) do instance_exec(&content_block) end end end |
#render(format, *args, &block) ⇒ Object
5 6 7 |
# File 'lib/card/bootstrap/component_klass.rb', line 5 def render format, *args, &block new(format, *args, &block).render end |