Class: Surfer::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/surfer/controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Controller

Returns a new instance of Controller.



3
4
5
6
7
8
# File 'lib/surfer/controller.rb', line 3

def initialize(args)
  @env = args[:env]
  @controller = args[:controller]
  @action = args[:action]
  @resource = args[:resource].downcase
end

Instance Method Details

#envObject



10
11
12
# File 'lib/surfer/controller.rb', line 10

def env
@env
end

#renderObject



14
15
16
17
18
19
20
# File 'lib/surfer/controller.rb', line 14

def render
  pth=ROOT_PATH+"/app/views/#{@resource}/#{@action}.html.erb"
  puts pth
  content = File.read(pth)
  eruby = Erubis::Eruby.new(content)
  eruby.result(binding())
end