Sha256: 99147a781b1b353a323813276d2cd5a3b098a73c1d62f4e0ae57a56165260592

Contents?: true

Size: 469 Bytes

Versions: 11

Compression:

Stored size: 469 Bytes

Contents

module HtmlFormat
  class Engine < Rails::Engine
    initializer 'html_format' do
      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

      if defined?(Mongoid::Document)
        Mongoid::Document.include(HtmlFormat::ActiveRecord)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
html_format-0.0.11 lib/html_format/engine.rb
html_format-0.0.10 lib/html_format/engine.rb
html_format-0.0.9 lib/html_format/engine.rb
html_format-0.0.8 lib/html_format/engine.rb
html_format-0.0.7 lib/html_format/engine.rb
html_format-0.0.6 lib/html_format/engine.rb
html_format-0.0.5 lib/html_format/engine.rb
html_format-0.0.4 lib/html_format/engine.rb
html_format-0.0.3 lib/html_format/engine.rb
html_format-0.0.2 lib/html_format/engine.rb
html_format-0.0.1 lib/html_format/engine.rb