Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add #ruby to call ruby methods on Noscript objects

  • Loading branch information...
commit 82ff7673e4f9ffc642c545ba3e2a4c22f4525e30 1 parent cf93347
@txus authored
Showing with 10 additions and 0 deletions.
  1. +4 −0 lib/noscript/runtime.rb
  2. +6 −0 test/compiler_test.rb
View
4 lib/noscript/runtime.rb
@@ -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
6 test/compiler_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.