Class: R::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/R_interface/rpkg.rb

Overview



Constant Summary collapse

@@packages =
{}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package_name) ⇒ Package

Returns a new instance of Package.



40
41
42
# File 'lib/R_interface/rpkg.rb', line 40

def initialize(package_name)
  @package_name = package_name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



44
45
46
47
# File 'lib/R_interface/rpkg.rb', line 44

def method_missing(symbol, *args)
  symbol = R::Support.convert_symbol2r(symbol)
  R::Support.exec_function_name("#{@package_name}::#{symbol}", *args)
end

Class Method Details

.[](package_name) ⇒ Object



35
36
37
38
# File 'lib/R_interface/rpkg.rb', line 35

def self.[](package_name)
  return @@packages[package_name] if @@packages.has_key?(package_name)
  @@packages[package_name] = new(package_name)
end