diff --git a/lib/fOOrth/core/proxy.rb b/lib/fOOrth/core/proxy.rb
index 3e5b040..3c47c4a 100644
--- a/lib/fOOrth/core/proxy.rb
+++ b/lib/fOOrth/core/proxy.rb
@@ -13,10 +13,9 @@ module XfOOrth
#
Parameters:
#* target_class - The Ruby class to be wrapped.
#* foorth_parent - The fOOrth class that serves as parent.
- #* exclusives - Are exclusive methods to be allowed?
#
Returns:
#* The newly created proxy class.
- def self.create_proxy(target_class, foorth_parent, exclusives=false)
+ def self.create_proxy(target_class, foorth_parent)
target_class.define_singleton_method(:foorth_parent) {foorth_parent}
target_class.define_singleton_method(:foorth_class) {XfOOrth.class_class}
target_class.define_singleton_method(:shared) {@shared ||= {}}
@@ -25,7 +24,7 @@ module XfOOrth
&lambda {target_class})
target_class.send(:define_method, :name,
- &lambda {"#{foorth_class.name} instance <#{@name}>."})
+ &lambda {"#{foorth_class.name} instance."})
target_class.extend(SharedCache)
target_class.extend(Shared)
diff --git a/sire.rb b/sire.rb
index aeb393a..0ef1546 100644
--- a/sire.rb
+++ b/sire.rb
@@ -45,7 +45,7 @@ end
class SIRE
#Set up the interactive session.
def initialize
- @done = false
+ @_done = false
@running = false
puts "Welcome to a Simple Interactive Ruby Environment\n"
@@ -54,39 +54,48 @@ class SIRE
#Quit the interactive session.
def q
- @done = true
+ @_done = true
puts
"Bye bye for now!"
end
+ #Load and run a file
+ def l(file_name)
+ @_break = false
+ lines = IO.readlines(file_name)
+
+ lines.each do |line|
+ exec_line(line)
+ return if @_break
+ end
+
+ "End of file '#{file_name}'."
+ end
+
+ #Execute a single line.
+ def exec_line(line)
+ result = eval line
+ pp result unless line.length == 0
+
+ rescue Interrupt => e
+ @_break = true
+ puts "\nExecution Interrupted!"
+ puts "\n#{e.class} detected: #{e}\n"
+ puts e.backtrace
+ puts "\n"
+
+ rescue Exception => e
+ @_break = true
+ puts "\n#{e.class} detected: #{e}\n"
+ puts e.backtrace
+ puts
+ end
+
#Run the interactive session.
def run_sire
- until @done
- begin
- line = Readline.readline('SIRE>', true)
- @running = true
- result = eval line
- @running = false
- pp result unless line.length == 0
-
- rescue Interrupt => e
- if @running
- @running = false
- puts "\nExecution Interrupted!"
- puts "\n#{e.class} detected: #{e}\n"
- puts e.backtrace
- else
- puts "\nI'm outta here!'"
- @done = true
- end
-
- puts "\n"
-
- rescue Exception => e
- puts "\n#{e.class} detected: #{e}\n"
- puts e.backtrace
- puts
- end
+ until @_done
+ @_break = false
+ exec_line(Readline.readline('SIRE>', true))
end
puts "\n\n"
diff --git a/t.txt b/t.txt
new file mode 100644
index 0000000..9c847fa
--- /dev/null
+++ b/t.txt
@@ -0,0 +1,3 @@
+XfOOrth.create_proxy(Numeric, XfOOrth.object_class)
+Numeric.name
+(4).name