Class: Rplex::Processor

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

Instance Method Summary collapse

Constructor Details

#initialize(client, interval = 30) ⇒ Processor

Returns a new instance of Processor.



90
91
92
93
# File 'lib/rplex/client.rb', line 90

def initialize client,interval=30
  @client=client
  @interval=interval
end

Instance Method Details

#run!Object



95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/rplex/client.rb', line 95

def run! 
  raise "You need to provide a block" unless block_given?
  while true do
    begin
      job_data=@client.next_job
      yield job_data unless job_data.empty?
    rescue ClientError
      puts $!
    end
    sleep @interval
  end
end