Class: Tcl::Interp
Class Method Summary collapse
Instance Method Summary collapse
- #expose(name) ⇒ Object
- #interp ⇒ Object
- #interp_receive(method, *args) ⇒ Object
- #proc(name) ⇒ Object
- #procs ⇒ Object
- #to_tcl ⇒ Object
- #var(name) ⇒ Object
- #vars ⇒ Object
Methods included from Utils
Class Method Details
.load_from_file(filename) ⇒ Object
6 7 8 |
# File 'lib/tcl/interp.rb', line 6 def load_from_file(filename) new.tap { _1.eval(File.read(filename)) } end |
Instance Method Details
#expose(name) ⇒ Object
19 20 21 |
# File 'lib/tcl/interp.rb', line 19 def expose(name) _!(:interp, :alias, nil, name, nil, :interp_send, name) end |
#interp ⇒ Object
11 12 13 |
# File 'lib/tcl/interp.rb', line 11 def interp self end |
#interp_receive(method, *args) ⇒ Object
15 16 17 |
# File 'lib/tcl/interp.rb', line 15 def interp_receive(method, *args) send("tcl_#{method}", *args) end |
#proc(name) ⇒ Object
23 24 25 |
# File 'lib/tcl/interp.rb', line 23 def proc(name) Tcl::Proc.new(self, name) end |
#procs ⇒ Object
31 32 33 |
# File 'lib/tcl/interp.rb', line 31 def procs list_to_array _!(:info, :procs) end |
#to_tcl ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/tcl/interp.rb', line 39 def to_tcl %w[var proc].each_with_object([]) do |type, lines| send("#{type}s").sort.each do |name| object = send(type, name) lines << object.to_tcl unless object.builtin? end end.join("\n") end |
#var(name) ⇒ Object
27 28 29 |
# File 'lib/tcl/interp.rb', line 27 def var(name) Tcl::Var.find(self, name) end |
#vars ⇒ Object
35 36 37 |
# File 'lib/tcl/interp.rb', line 35 def vars list_to_array _!(:info, :vars) end |