Sha256: 91d7e63a73857a5e8545ee94717968d46589381cc981aebe050e4e38a9080bf8

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

require "active_support"
require "active_support/core_ext/object/blank"

class Code
  def initialize(input)
    @input = input
    @parsed = ::Code::Parser::Code.new.parse(@input)
  end

  def self.evaluate(input, context = "")
    new(input).evaluate(context)
  end

  def evaluate(context = "")
    if context.present?
      context = ::Code.evaluate(context)
    else
      context = ::Code::Object::Dictionnary.new
    end

    ::Code::Node::Code.new(parsed).evaluate(context)
  end

  private

  attr_reader :input, :parsed
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
template-ruby-0.1.0 lib/code.rb