Sha256: c5aec3b280df8db64ce6512337e47120d977cff1fd2a143896f38d8037b7e8bb

Contents?: true

Size: 361 Bytes

Versions: 1

Compression:

Stored size: 361 Bytes

Contents

module Petroglyph
  class Engine

    def initialize(data = nil)
      @data = data
    end

    def render(context = Object.new, locals = {}, file = nil, &block)
      scope = Scope.new(context, locals, file)
      if @data
        scope.instance_eval(@data)
      else
        scope.instance_eval(&block)
      end
      scope.value.to_json
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
petroglyph-0.0.1 lib/petroglyph/engine.rb