Permalink
Browse files

Add #ruby to call ruby methods on Noscript objects

  • Loading branch information...
1 parent cf93347 commit 82ff7673e4f9ffc642c545ba3e2a4c22f4525e30 @txus committed Jan 25, 2012
Showing with 10 additions and 0 deletions.
  1. +4 −0 lib/noscript/runtime.rb
  2. +6 −0 test/compiler_test.rb
View
@@ -22,6 +22,10 @@ def noscript_send(name, *args)
__send__ "noscript:#{send}", *args
end
+ noscript_def("ruby") do |*args|
+ send *args
+ end
+
noscript_alias [:==, :"!="]
noscript_def("@!") { !self }
View
@@ -179,5 +179,11 @@ def test_self_equals_deref
def test_self_equals_deref_on_asignment
assert_equal 7, compile("@foo = 7; self.foo")
end
+
+ def test_ruby_call
+ identifier = compile("Noscript.AST.Identifier.ruby('new', 1, 'foo')")
+ assert_equal 1, identifier.line
+ assert_equal 'foo', identifier.name
+ end
end
end

0 comments on commit 82ff767

Please sign in to comment.