Class: Tcl::Var
Constant Summary collapse
- BUILTINS =
%w[ auto_index auto_oldpath auto_path env errorCode errorInfo tcl_libPath tcl_library tcl_patchLevel tcl_pkgPath tcl_platform tcl_version ].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #builtin? ⇒ Boolean
-
#initialize(interp, name) ⇒ Var
constructor
A new instance of Var.
Methods included from Delegator
included, #method_missing, #respond_to_missing?
Methods included from Utils
Constructor Details
#initialize(interp, name) ⇒ Var
Returns a new instance of Var.
25 26 27 28 29 |
# File 'lib/tcl/var.rb', line 25 def initialize(interp, name) @interp = interp @name = name.to_s to_tcl end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Tcl::Delegator
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/tcl/var.rb', line 23 def name @name end |
Class Method Details
.find(interp, name) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/tcl/var.rb', line 12 def find(interp, name) if interp._!(:array, :exists, name) == '1' ArrayVar.new(interp, name) elsif interp._!(:info, :exists, name) == '1' StringVar.new(interp, name) else raise Tcl::Error, "can't read \"#{name}\": no such variable" end end |
Instance Method Details
#builtin? ⇒ Boolean
31 32 33 |
# File 'lib/tcl/var.rb', line 31 def builtin? BUILTINS.include?(name) end |