Class: BitGirder::Concurrent::Retry::Builder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBuilder

Returns a new instance of Builder.



180
181
182
183
184
185
186
187
# File 'lib/bitgirder/concurrent.rb', line 180

def initialize
    
    # Set defaults
    @retries = 3
    @seed_secs = 1.0
    @failed = lambda { |err| raise err }
    @retry_on = [ Exception ]
end

Instance Attribute Details

#retriesObject

Returns the value of attribute retries.



178
179
180
# File 'lib/bitgirder/concurrent.rb', line 178

def retries
  @retries
end

#seed_secsObject

Returns the value of attribute seed_secs.



178
179
180
# File 'lib/bitgirder/concurrent.rb', line 178

def seed_secs
  @seed_secs
end

Instance Method Details

#retry_on(*argv, &blk) ⇒ Object



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/bitgirder/concurrent.rb', line 200

def retry_on( *argv, &blk )

    if blk
        if argv.empty?
            @retry_on = blk
        else
            raise "Can't combine block and rescue target list"
        end
    else
        if argv.empty?
            raise "Need at least one rescue target"
        else
            @retry_on = Array.new( argv )
        end
    end
end