Sha256: f92419e5c945264a83312f38dc224c71659f95e5aaf209b3bd18ba391c1fcf82

Contents?: true

Size: 1.46 KB

Versions: 6

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

require "parallel"

module Miteru
  class Configuration
    # @return [Boolean]
    attr_accessor :auto_download

    # @return [Boolean]
    attr_accessor :ayashige

    # @return [Boolean]
    attr_accessor :directory_traveling

    # @return [String]
    attr_accessor :download_to

    # @return [Boolean]
    attr_accessor :post_to_slack

    # @return [Integer]
    attr_accessor :size

    # @return [Integer]
    attr_accessor :threads

    # @return [Boolean]
    attr_accessor :verbose

    def initialize
      @auto_download = false
      @ayashige = false
      @directory_traveling = false
      @download_to = "/tmp"
      @post_to_slack = false
      @size = 100
      @threads = Parallel.processor_count
      @verbose = false
    end

    def auto_download?
      @auto_download
    end

    def ayashige?
      @ayashige
    end

    def directory_traveling?
      @directory_traveling
    end

    def post_to_slack?
      @post_to_slack
    end

    def verbose?
      @verbose
    end
  end

  class << self
    # @return [Miteru::Configuration] Miteru's current configuration
    def configuration
      @configuration ||= Configuration.new
    end

    # Set Miteru's configuration
    # @param config [Miteru::Configuration]
    attr_writer :configuration

    # Modify Miteru's current configuration
    # @yieldparam [Miteru::Configuration] config current Miteru config
    def configure
      yield configuration
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
miteru-0.14.2 lib/miteru/configuration.rb
miteru-0.14.1 lib/miteru/configuration.rb
miteru-0.14.0 lib/miteru/configuration.rb
miteru-0.13.0 lib/miteru/configuration.rb
miteru-0.12.13 lib/miteru/configuration.rb
miteru-0.12.12 lib/miteru/configuration.rb