Sha256: cf216e0ecee9403a0d489588f252c0e9904926f86bfd8e3fa70c6c48aa9494ce

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

require "html_format/generator"
require "html_format/core_ext"
require "html_format/version"

if defined?(Rails::Engine)
  require 'html_format/engine'
else
  if defined?(ActiveSupport)
    ActiveSupport.on_load(:active_record) do
      include HtmlFormat::ActiveRecord

      ActiveRecord::Result.class_eval do
        def to_html(options = {})
          HtmlFormat.generate(collect(&:to_h), options)
        end
      end
    end
  end
  if defined?(Mongoid::Document)
    Mongoid::Document.include(HtmlFormat::ActiveRecord)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
html_format-0.0.11 lib/html_format.rb
html_format-0.0.10 lib/html_format.rb