Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#require

  • Loading branch information...
commit af0f9435680977ca92410d812a399fa5a245897d 1 parent 5e90aa7
@txus authored
View
2  kernel/test_case.nsc
@@ -1,5 +1,5 @@
!RBIX
-2199918003027222139
+14826142347510856616
0
M
1
View
2  kernel/traits.nsc
@@ -1,5 +1,5 @@
!RBIX
-2199918003027222139
+14826142347510856616
0
M
1
View
21 lib/noscript/runtime.rb
@@ -90,8 +90,8 @@ def method_missing(m, *args)
end
module Kernel
- def noscript_require(file)
- here = File.dirname(caller.first.split(":").first)
+ def noscript_require(file, backtrace=caller)
+ here = File.dirname(backtrace.first.split(":").first)
old_paths = Noscript::CodeLoader.load_paths
Noscript::CodeLoader.load_paths.unshift(here)
Noscript::CodeLoader.run(file)
@@ -175,9 +175,24 @@ def noscript_send(name, *args)
send *args
end
+ noscript_def("require") do |file|
+ backtrace = [caller.detect {|line| line =~ /eval_noscript/}]
+ noscript_require(file, backtrace)
+ end
+
+ noscript_def("ruby require") do |file|
+ require file
+ end
+
+ noscript_def("ruby require relative") do |file|
+ backtrace = [caller.detect {|line| line =~ /eval_noscript/}]
+ here = File.dirname(backtrace.first.split(":").first)
+ require File.expand_path(File.join(here, file))
+ end
+
noscript_alias [:==, :"!="]
noscript_alias [:include, :extend, :def]
- noscript_def("@!") { !self }
+ noscript_def("!") { !self }
noscript_alias :nil?
noscript_alias :inspect
Please sign in to comment.
Something went wrong with that request. Please try again.