Class: ERObj
- Inherits:
-
Object
- Object
- ERObj
- Defined in:
- lib/rsruby/erobj.rb
Direct Known Subclasses
Constant Summary collapse
- @@x =
1
Instance Method Summary collapse
-
#as_r ⇒ Object
Returns the wrapped RObj when RSRuby attempts to convert it to R.
-
#initialize(robj) ⇒ ERObj
constructor
Requires an RObj for intialization.
-
#lcall(args) ⇒ Object
Calls the wrapped RObj.
- #method_missing(attr) ⇒ Object
-
#to_s ⇒ Object
Outputs the string representation provided by R.
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(attr) ⇒ Object
89 90 91 92 93 94 95 |
# File 'lib/rsruby/erobj.rb', line 89 def method_missing(attr) mode = RSRuby.get_default_mode RSRuby.set_default_mode(RSRuby::BASIC_CONVERSION) e = @r['$'].call(@robj,attr.to_s) RSRuby.set_default_mode(mode) return e end |
Instance Method Details
#as_r ⇒ Object
Returns the wrapped RObj when RSRuby attempts to convert it to R.
57 58 59 |
# File 'lib/rsruby/erobj.rb', line 57 def as_r @robj.as_r end |
#lcall(args) ⇒ Object
Calls the wrapped RObj.
62 63 64 |
# File 'lib/rsruby/erobj.rb', line 62 def lcall(args) @robj.lcall(args) end |
#to_s ⇒ Object
Outputs the string representation provided by R.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/rsruby/erobj.rb', line 67 def to_s @@x += 1 mode = RSRuby.get_default_mode RSRuby.set_default_mode(RSRuby::NO_CONVERSION) a = @r.textConnection("tmpobj#{@@x}",'w') RSRuby.set_default_mode(RSRuby::BASIC_CONVERSION) @r.sink(:file => a, :type => 'output') @r.print_(@robj) @r.sink.call() @r.close_connection(a) str = @r["tmpobj#{@@x}"].join("\n") RSRuby.set_default_mode(mode) return str end |