Class: Tipsy::Handler::PhpProcessor
- Inherits:
-
Object
- Object
- Tipsy::Handler::PhpProcessor
- Defined in:
- lib/tipsy/handler/php.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(d) ⇒ PhpProcessor
constructor
A new instance of PhpProcessor.
- #render ⇒ Object
Constructor Details
#initialize(d) ⇒ PhpProcessor
Returns a new instance of PhpProcessor.
25 26 27 |
# File 'lib/tipsy/handler/php.rb', line 25 def initialize(d) @data = d end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
23 24 25 |
# File 'lib/tipsy/handler/php.rb', line 23 def data @data end |
Instance Method Details
#render ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/tipsy/handler/php.rb', line 29 def render file = Tempfile.new("tipsy_php_#{Time.now.to_i}") result = "" begin file.write(@data) file.rewind result = `php #{file.path}` ensure file.close file.unlink end result end |