Module: ActiveRecord::ToHtml
- Included in:
- Base
- Defined in:
- lib/vex/active_record/to_html.rb
Instance Method Summary collapse
Instance Method Details
#to_html(options = {}, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/vex/active_record/to_html.rb', line 2 def to_html( = {}, &block) = { :skip_instruct => true, }.update() to_xml(, &block).gsub( /<[^>]+>/ ) do |m| if m.starts_with?("</") "</div>" else m =~ /^<(\S+)\s*([^>]*)>$/ klass, args = $1, $2 "<div class='#{klass}'#{args.blank? ? "" : " #{args}"}>" end end end |