Module: MithrilHelper
- Defined in:
- app/helpers/mithril_helper.rb
Instance Method Summary collapse
Instance Method Details
#mithril_component(name, args = {}, options = {}, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/mithril_helper.rb', line 2 def mithril_component(name, args = {}, = {}, &block) = {:tag => } if .is_a?(Symbol) = .reverse_merge(:data => {}) [:data].tap do |data| data[:mithril_class] = name data[:mithril_props] = args.to_json unless args.empty? end html_tag = .delete(:tag) || :div content_tag(html_tag, '', , &block) end |