module RocketJob::Category::Base

Define the layout for each category of input or output data

Public Instance Methods

build_collection_name(direction, job) click to toggle source
# File lib/rocket_job/category/base.rb, line 74
def build_collection_name(direction, job)
  collection_name = "rocket_job.#{direction}s.#{job.id}"
  collection_name << ".#{name}" unless name == :main
  collection_name
end
serializer_class() click to toggle source

Return which slice serializer class to use that matches the current options.

# File lib/rocket_job/category/base.rb, line 43
def serializer_class
  case serializer
  when :none
    Sliced::Slice
  when :compress
    Sliced::CompressedSlice
  when :encrypt
    Sliced::EncryptedSlice
  when :bzip2, :bz2
    Sliced::BZip2OutputSlice
  when :encrypted_bz2
    Sliced::EncryptedBZip2OutputSlice
  else
    raise(ArgumentError, "serialize: #{serializer.inspect} must be :none, :compress, :encrypt, :bz2, or :encrypted_bz2")
  end
end
tabular() click to toggle source
# File lib/rocket_job/category/base.rb, line 60
def tabular
  @tabular ||= IOStreams::Tabular.new(
    columns:        columns,
    format:         format == :auto ? nil : format,
    format_options: format_options&.to_h&.deep_symbolize_keys,
    file_name:      file_name
  )
end
tabular?() click to toggle source

Returns [true|false] whether this category has the attributes defined for tabular to work.

# File lib/rocket_job/category/base.rb, line 70
def tabular?
  format.present?
end