Class: RSC

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

Defined Under Namespace

Classes: Package

Instance Method Summary collapse

Constructor Details

#initialize(drb_hostname = 'rse', port: '61000', debug: false) ⇒ RSC

Returns a new instance of RSC.



47
48
49
50
51
52
53
# File 'lib/rsc.rb', line 47

def initialize(drb_hostname='rse', port: '61000', debug: false)
  
  @port, @debug = port, debug
  
  drb_start(drb_hostname)
  
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (private)



83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/rsc.rb', line 83

def method_missing(method_name, *args)

  if @debug then
    puts 'method_missing'.info 
    puts ('method_name: ' + method_name.inspect).debug
  end
  
  begin
    Package.new @obj, method_name.to_s, debug: @debug
  rescue
    # nil will be returned if there is no package by that name
  end
  
end

Instance Method Details

#delete(s = nil) ⇒ Object



55
56
57
# File 'lib/rsc.rb', line 55

def delete(s=nil)
  s ? run_uri(s, :delete) :  @obj.delete
end

#get(s = nil) ⇒ Object



59
60
61
# File 'lib/rsc.rb', line 59

def get(s=nil)
  s ? run_uri(s, :get) :  @obj.get
end

#post(s = nil, val = nil) ⇒ Object



63
64
65
# File 'lib/rsc.rb', line 63

def post(s=nil, val=nil)
  s ? run_uri(s, :post, value: val) :  @obj.post
end

#put(s = nil, val = nil) ⇒ Object



67
68
69
# File 'lib/rsc.rb', line 67

def put(s=nil, val=nil)
  s ? run_uri(s, :put, value: val) :  @obj.put
end

#run_job(package, job, params = {}, *qargs, package_path: nil) ⇒ Object



72
73
74
# File 'lib/rsc.rb', line 72

def run_job(package, job, params={}, *qargs, package_path: nil)
  @obj.run_job(package, job, params, qargs, package_path)
end