Sha256: 47e3717b60087a73433204b7da1bb348ecf547888125ae4902160a767678a6ee
Contents?: true
Size: 618 Bytes
Versions: 1
Compression:
Stored size: 618 Bytes
Contents
require 'erubis' require 'rhino/file_model' module Rhino class Controller include Rhino::Model def initialize(env) @env = env end def env @env end def render(view_name, locals={}) file_name = File.join Rhino::Application.root_path, 'app', 'views', controller_name, "#{view_name}.html.erb" template = File.read file_name eruby = Erubis::Eruby.new(template) eruby.result locals.merge(env: env) end def controller_name klass = self.class klass = klass.to_s.gsub(/Controller$/, "") Rhino.to_underscore(klass) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rhino-framework-0.0.4 | lib/rhino/controller.rb |