Sha256: 8ed9ad52a80ed68bca771849e8d3a1934296997986f42faa2f6667064a7bc97f

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

module Ruby2html
  class TemplateHandler
    class_attribute :default_format
    self.default_format = :html

    def self.call(template, source)
      new.call(template, source)
    end

    def call(_template, source)
      <<-RUBY
        Ruby2html::Render.new(self) do
          #{source}
        end.render
      RUBY
    end
  end

  class Railtie < Rails::Railtie
    initializer 'ruby2html.initializer' do
      Rails.autoloaders.main.ignore(
        Rails.root.join('app/views/**/*.html.rb'),
        Rails.root.join('app/components/**/*.html.rb')
      )
    end
  end
end

ActionView::Template.register_template_handler :rb, Ruby2html::TemplateHandler if defined? ActionView::Template

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby2html-1.2.0 lib/gem/ruby2html/railtie.rb