Class: PubliSci::Client

Inherits:
Object
  • Object
show all
Includes:
Rconnect
Defined in:
lib/bio-publisci/r_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Rconnect

#connect, #get, #get_vars, #load_workspace

Constructor Details

#initialize(auto = true, loc = Dir.home) ⇒ Client

Returns a new instance of Client.



31
32
33
34
35
36
# File 'lib/bio-publisci/r_client.rb', line 31

def initialize(auto=true, loc=Dir.home)
    @R = connect
	@loc = loc
	load_ws if auto
	puts "vars: #{vars.payload}" if auto
end

Instance Attribute Details

#RObject (readonly)

Returns the value of attribute R.



29
30
31
# File 'lib/bio-publisci/r_client.rb', line 29

def R
  @R
end

Instance Method Details

#get_var(var) ⇒ Object



42
43
44
# File 'lib/bio-publisci/r_client.rb', line 42

def get_var(var)
	get(@R,var)
end

#get_wsObject



46
47
48
# File 'lib/bio-publisci/r_client.rb', line 46

def get_ws
	"#{@loc}/.RData"
end

#load_wsObject



38
39
40
# File 'lib/bio-publisci/r_client.rb', line 38

def load_ws
	load_workspace(@R, @loc)
end

#varsObject



50
51
52
# File 'lib/bio-publisci/r_client.rb', line 50

def vars
	get_vars(@R)
end