Sha256: 5b8bae4f319ae97727acf222e2d9ecc1e494d2df86a5fea4689a8d79fde427bc

Contents?: true

Size: 493 Bytes

Versions: 2

Compression:

Stored size: 493 Bytes

Contents

require 'action_view/base'
require 'action_view/template'

module ActionView
  module Template::Handlers
    class ArgonautBuilder < Template::Handler
      include Compilable

      self.default_format = Mime::JSON

      def compile(template)
        "doc = ::Argonaut::Generator.new do |json|" +
          template.source +
        "end;doc.to_json;"
      end
    end
  end
end

ActionView::Template.register_template_handler :json_builder, ActionView::Template::Handlers::ArgonautBuilder

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
argonaut-0.0.2 lib/argonaut/template.rb
argonaut-0.0.1 lib/argonaut/template.rb