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', parent_url = nil, port: '61000') ⇒ RSC

Returns a new instance of RSC.



54
55
56
57
58
59
60
61
62
63
# File 'lib/rsc.rb', line 54

def initialize(drb_hostname='rse', parent_url=nil, port: '61000')
  
  @port = port
  
  if parent_url then
    @parent_url = parent_url
    drb_start(drb_hostname)
  end
  
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



93
94
95
96
97
98
99
100
101
# File 'lib/rsc.rb', line 93

def method_missing(method_name, *args)
  
  begin
    Package.new @obj, @parent_url, method_name.to_s
  rescue
    # nil will be returned if there is no package by that name
  end
  
end

Instance Method Details

#delete(s = nil) ⇒ Object



65
66
67
# File 'lib/rsc.rb', line 65

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

#get(s = nil) ⇒ Object



69
70
71
# File 'lib/rsc.rb', line 69

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

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



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

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

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



77
78
79
# File 'lib/rsc.rb', line 77

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



82
83
84
# File 'lib/rsc.rb', line 82

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