Permalink
Browse files

Made calling remote functions from Ruby more transparent.

  • Loading branch information...
steveWang committed Aug 6, 2011
1 parent 5160e25 commit 6c421e357f30ddd1b26565b6b660fc19f464f956
Showing with 13 additions and 5 deletions.
  1. +3 −0 lib/ruby-now.rb
  2. +9 −4 lib/util.rb
  3. +1 −1 ruby-now.gemspec
View
@@ -10,6 +10,9 @@ module RubyNow
def self.conn
@@conn
end
+ def self.remoteCall name
+ Util.remoteCall name
+ end
def self.registerFunction name, block
Util.registerFunction name, block
end
View
@@ -27,16 +27,21 @@ def self.callFunc func, args
@@functions[a['fqn']] :
(@@closures.has_key?(a['fqn']) ?
@@closures[a['fqn']] :
- (lambda{|*args|
- self.send_data({ "name" => "rfc",
- "args" => [{ "fqn" => a['fqn'],
- "args" => args }] }.to_json) }))) :
+ self.remoteCall(a['fqn']))):
(a.is_a?(Proc) ?
(((@@closures[a.to_s] = a) && true) ||
{"fqn" => a.to_s}) :
a))
})
end
+ def self.remoteCall a
+ (lambda{|*args|
+ self.send_data({ "name" => "rfc",
+ "args" => [{ "fqn" => a,
+ "args" => args }] }.to_json)
+ })
+ end
+
def self.send_data str
RubyNow.conn[0].send_data str
end
View
@@ -1,7 +1,7 @@
require 'eventmachine'
Gem::Specification.new do |s|
s.name = 'ruby-now'
- s.version = '0.0.1'
+ s.version = '0.0.2'
s.homepage = 'http://nowjs.org'
s.authors = ["Flotype"]

0 comments on commit 6c421e3

Please sign in to comment.