Class: Backburner::Client
- Inherits:
-
BackburnerObject
- Object
- BackburnerObject
- Backburner::Client
- Defined in:
- lib/backburner/client.rb
Instance Attribute Summary collapse
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Attributes inherited from BackburnerObject
Instance Method Summary collapse
- #connect ⇒ Object
- #disconnect ⇒ Object
-
#initialize(host, port = 3234) ⇒ Client
constructor
A new instance of Client.
- #jobs ⇒ Object
Methods inherited from BackburnerObject
Constructor Details
#initialize(host, port = 3234) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 |
# File 'lib/backburner/client.rb', line 7 def initialize host, port=3234 @host = host @port = port @connection = Connection.new @host, @port send_client_info self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Backburner::BackburnerObject
Instance Attribute Details
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
5 6 7 |
# File 'lib/backburner/client.rb', line 5 def raw_data @raw_data end |
Instance Method Details
#connect ⇒ Object
15 16 17 |
# File 'lib/backburner/client.rb', line 15 def connect @connection = Connection.new @host, @port end |
#disconnect ⇒ Object
19 20 21 |
# File 'lib/backburner/client.rb', line 19 def disconnect @connection.close end |
#jobs ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/backburner/client.rb', line 23 def jobs response = @connection.jobhlist.get return [] if @connection.empty? job_handlers = response.jobh_list.job job_handlers = [job_handlers] unless job_handlers.kind_of?(Array) job_handlers.map do |job_data| Job.new job_data.handle, @connection end end |