Sha256: 219543cf456104631d28df4abd29cd1124725766bf247701b6c259815caaa241

Contents?: true

Size: 475 Bytes

Versions: 2

Compression:

Stored size: 475 Bytes

Contents

require 'spire/http'
require 'haml' 

module Spire
  class MainController
    
    def initialize(base_path)
      @base_path = base_path
    end
    
    def render(view, type="haml", data="")
      if type == "html"
        File.open(@base_path+'/views/'+view+'.html', 'r').read
      elsif type == "haml"
        file = File.open(@base_path+'/views/'+view+'.haml', 'r').read
        Haml::Engine.new(file).render(Object.new, :data => data)
      end
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spire-0.2.0 lib/spire/class/MainController.rb
spire-0.1.10 lib/spire/class/MainController.rb