Sha256: 9833241efa26f81fed900a1f9adec009ba1c6448f35f32ee5643bbcd6c196dfd

Contents?: true

Size: 374 Bytes

Versions: 2

Compression:

Stored size: 374 Bytes

Contents

require 'rabl'
require 'json'

module Gon
  module Sinatra
    module Rabl
      class << self
        def parse_rabl(rabl_path, controller)
          source = File.read(rabl_path)
          rabl_engine = ::Rabl::Engine.new(source, :format => 'json')
          output = rabl_engine.render(controller, {})
          JSON.parse(output)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gon-sinatra-0.0.6 lib/gon/sinatra/rabl.rb
gon-sinatra-0.0.5 lib/gon/sinatra/rabl.rb