Class: Renjin::Environment
- Inherits:
-
RubySexp
- Object
- RubySexp
- Renjin::Environment
- Defined in:
- lib/JRubyR/environment.rb
Instance Attribute Summary
Attributes included from RBSexp
Instance Method Summary (collapse)
-
- (Object) method_missing(symbol, *args)
----------------------------------------------------------------------------------------.
Methods inherited from RubySexp
build, #fassign, #initialize, #to_string
Methods included from RBSexp
#destroy, #ncol, #nrow, #pp, #print, #r, #rclass, #sexp?, #typeof, #unbind
Constructor Details
This class inherits a constructor from Renjin::RubySexp
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(symbol, *args)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/JRubyR/environment.rb', line 33 def method_missing(symbol, *args) name = symbol.id2name if name =~ /(.*)=$/ # should never reach this point. Parse error... but check raise ArgumentError, "You shouldn't assign nil" if args==[nil] super if args.length != 1 ret = R.assign($1,args[0]) else name.gsub!(/__/,".") # super if args.length != 0 if (args.length == 0) # treat the argument as a named item of the list ret = Renjin::RubySexp.build(@sexp.getVariable(name)) else params = parse(*args) ret = eval("#{name}(#{params})") end end ret end |