module HireFire::Macro::Deprecated::Que::Private

@!visibility private

Constants

QUE_V0_QUERY

SQL query string for Que version 0.

QUE_V1_QUERY

SQL query string for Que version 1.

Public Instance Methods

base_query() click to toggle source

Determines the base query to use for counting jobs, depending on the Que version.

@return [String] The base SQL query string.

# File lib/hirefire/macro/deprecated/que.rb, line 35
def base_query
  return QUE_V0_QUERY if defined?(::Que::Version)
  return QUE_V1_QUERY if defined?(::Que::VERSION)
  raise "Couldn't find Que version"
end
names(queues) click to toggle source

Formats queue names for SQL query.

@param queues [Array<String>] The names of the queues. @return [String] Formatted queue names for SQL IN clause.

# File lib/hirefire/macro/deprecated/que.rb, line 45
def names(queues)
  queues.map { |queue| "'#{queue}'" }.join(",")
end
query_const(query) click to toggle source

Formats and freezes a SQL query string for use.

@param query [String] The raw SQL query string. @return [String] The formatted and frozen SQL query string.

# File lib/hirefire/macro/deprecated/que.rb, line 53
def query_const(query)
  query.gsub(/\s+/, " ").strip.freeze
end