class NetMate::Controller

Public Class Methods

new() click to toggle source
# File lib/net_mate/controller.rb, line 4
def initialize
  @params = {}
end

Public Instance Methods

render(erb_name) click to toggle source
# File lib/net_mate/controller.rb, line 8
def render erb_name
  erb_name = erb_name.dup
  erb_name << '.html.erb'
  unless erb_name.start_with? '/'
    class_name = self.class.name      
    erb_dir = "#{(class_name[0..(class_name.rindex('Controller').pred)]).downcase}"
    erb_path = "#{ROOT_PATH}/app/views/#{erb_dir}/#{erb_name}"
  else
    erb_path = erb_name
  end
  body = Erubis::Eruby.new(IO.read(erb_path)).result(binding())
  Response.new(body).respond
end