class Crafti::FileReader

Attributes

content[R]

Public Class Methods

execute(string) click to toggle source
# File lib/crafti.rb, line 95
def self.execute(string)
  eval string
end
generate(file) click to toggle source
# File lib/crafti.rb, line 82
def self.generate(file)
  app = new(file)
  app.evaluate
end
new(file) click to toggle source
# File lib/crafti.rb, line 88
def initialize(file)
  @content  = ::Pathname.new(file.to_s).expand_path.read
end

Public Instance Methods

evaluate() click to toggle source
# File lib/crafti.rb, line 92
def evaluate
  klass = Class.new do
    ::Kernel.extend(Crafti::KernelExtension)
    def self.execute(string)
      eval string
    end
  end

  klass.execute(content)
end