module Refried::Getter::InstanceMethods

Public Instance Methods

get(timeout=nil, &block) click to toggle source

Get a the next job from the tube

@param timeout [Integer] Number of seconds before timing out @param block [Proc] Callback to perform on reserved job @return [Beanstalk::Job] the next job from the tube

# File lib/refried/getter.rb, line 54
def get(timeout=nil, &block)
  timeout ||= ::Refried.configuration.reserve_timeout
  tube = ::Refried.tubes.find self.getter_tube_name.to_s
  tube.reserve timeout, &block
end
getter_tube_name() click to toggle source

Get the currently registered tube name

@return [Symbol] the tube name

# File lib/refried/getter.rb, line 36
def getter_tube_name
  @getter_tube_name ||= nil
end
Also aliased as: tube_name
getter_tube_name=(tube_name) click to toggle source

Set the tube name - this only has an impact when using the :tube_name getter mode

@param tube_name [Symbol] the value to set the tube name

# File lib/refried/getter.rb, line 44
def getter_tube_name=(tube_name)
  @getter_tube_name = tube_name
end
Also aliased as: tube_name=
tube_name()
Alias for: getter_tube_name
tube_name=(tube_name)
Alias for: getter_tube_name=

Protected Instance Methods

attempt_to_log(message) click to toggle source
# File lib/refried/getter.rb, line 70
def attempt_to_log (message)
  begin
    logger.info message
  rescue => e
    #puts "Failed to access logger, message that should have been logged = #{message}"
  end
end
locatable?(selectors = {}) click to toggle source
# File lib/refried/getter.rb, line 61
def locatable? (selectors = {})
  case self.class.getter_mode
    when :tube_name
      true
    else
      false
  end
end