Sha256: 6fd5eb3d511e011749514f5318a3e5ec96b6f8234664bbece69248b852c1d724

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

module Callisto

  class Configuration

    module Defaults

      POOL = {
        :identifier  => proc { |task| task.command },
        :callback    => proc { |task| task.run },
        :max_workers => 4
      }

    end

    attr_accessor :thumbnail_defaults

    def initialize
      self.thumbnail_defaults = {}
      load_defaults
    end

    def load_defaults
      Pool.settings = Defaults::POOL
    end

    def max_workers=(val)
      Pool.settings.max_workers = val
    end

    def method_missing(method, *args, &block)
      if /^thumbnail_(?<name>[a-z\_]+)(?<setter>=)?/ =~ method
        if setter
          self.thumbnail_defaults[name] = args.first
        else
          thumbnail_defaults[name]
        end
      else
        super
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
callisto-0.9 lib/callisto/configuration.rb