Class: PHPHandler
- Inherits:
-
ActionView::TemplateHandler
- Object
- ActionView::TemplateHandler
- PHPHandler
- Defined in:
- lib/phuby/rails.rb
Defined Under Namespace
Classes: ControllerProxy, Events
Instance Method Summary collapse
-
#initialize(view) ⇒ PHPHandler
constructor
A new instance of PHPHandler.
- #render(template, *args) ⇒ Object
Constructor Details
#initialize(view) ⇒ PHPHandler
Returns a new instance of PHPHandler.
25 26 27 28 |
# File 'lib/phuby/rails.rb', line 25 def initialize view @controller = view.controller @proxy = ControllerProxy.new @controller end |
Instance Method Details
#render(template, *args) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/phuby/rails.rb', line 30 def render template, *args filename = File.join template.load_path, template.template_path events = Events.new(200, {}, '') Dir.chdir(File.dirname(filename)) do Phuby::Runtime.php do |rt| rt.eval "date_default_timezone_set('America/Los_Angeles');" rt['at'] = @proxy rt.with_events(events) do open(filename) { |f| rt.eval f } end end end events.body end |