Sha256: 6003b1d7340e2db5efa9abb6c035ab41cfcfd12d9c3116421b34e7cca0da01dd

Contents?: true

Size: 726 Bytes

Versions: 6

Compression:

Stored size: 726 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

if defined?(Tapp)
  module Tapp::Printer
    class HtmlFormat < Base
      def print(*args)
        puts html_format(*args)
      end
    end

    register :html_format, HtmlFormat
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
html_format-0.0.6 lib/html_format.rb
html_format-0.0.5 lib/html_format.rb
html_format-0.0.4 lib/html_format.rb
html_format-0.0.3 lib/html_format.rb
html_format-0.0.2 lib/html_format.rb
html_format-0.0.1 lib/html_format.rb