Class: Php_process::Created_function

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

Overview

This class handels the ability to create functions on the PHP-side.

Examples

$callback_from_php = “test” func = php.create_func do |arg|

$callback_from_php = arg

end

$callback_from_php #=> “test” func.call(‘test2’) $callback_from_php #=> “test2”

The function could also be called from PHP, but for debugging purposes it can also be done from Ruby.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Created_function

Sets the data. This is done from “Php_process” automatically.



470
471
472
# File 'lib/php_process.rb', line 470

def initialize(args)
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Various data about the create function will can help identify it on both the Ruby and PHP-side.



467
468
469
# File 'lib/php_process.rb', line 467

def args
  @args
end

Instance Method Details

#call(*args) ⇒ Object

Asks PHP to execute the function on the PHP-side, which will trigger the callback in Ruby afterwards. This method is useually called for debugging purposes.



475
476
477
# File 'lib/php_process.rb', line 475

def call(*args)
  @args[:php].send(:type => :call_created_func, :id => @args[:id], :args => @args[:php].parse_data(args))
end