Class: Surfer::Controller
- Inherits:
-
Object
- Object
- Surfer::Controller
- Defined in:
- lib/surfer/controller.rb
Instance Method Summary collapse
- #env ⇒ Object
-
#initialize(args) ⇒ Controller
constructor
A new instance of Controller.
- #render ⇒ Object
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
#env ⇒ Object
10 11 12 |
# File 'lib/surfer/controller.rb', line 10 def env @env end |
#render ⇒ Object
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 |