Sha256: 7f6869819976659cc272d7239a84433f86eb4f0c92f2cacdea061f287b9ccc80

Contents?: true

Size: 601 Bytes

Versions: 3

Compression:

Stored size: 601 Bytes

Contents

module Transcript
  class Configuration
    CREATE_MODES = [:asynchronous, :synchronous]

    class UnsupportedCreateMode < StandardError; end

    attr_accessor :audit_model
    attr_reader :create_mode

    def initialize
      @create_mode = :synchronous
    end

    def create_mode=(mode)
      mode = mode.to_sym

      raise UnsupportedCreateMode unless CREATE_MODES.include?(mode)
      @create_mode = mode
    ensure
      @create_mode = :synchronous if @create_mode.nil?
    end

    def job_method
      create_mode.to_sym == :asynchronous ? :perform_later : :perform_now
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
transcript-0.3.0 lib/transcript/configuration.rb
transcript-0.2.1 lib/transcript/configuration.rb
transcript-0.2.0 lib/transcript/configuration.rb