Sha256: 01b46aec59ce2e20e81e9b3e82bfa089680ea0fabb7a1eea302b27c1f79787c8
Contents?: true
Size: 852 Bytes
Versions: 5
Compression:
Stored size: 852 Bytes
Contents
class ImageOptim # Hold information about an option class OptionDefinition attr_reader :name, :default, :type, :description, :proc def initialize(name, default, type_or_description, description = nil, &proc) if type_or_description.is_a?(Class) type = type_or_description else type, description = default.class, type_or_description end @name = name.to_sym @description = description.to_s @default, @type, @proc = default, type, proc end # Get value for worker from options def value(worker, options) value = options.key?(name) ? options[name] : default if proc if proc.arity == 2 worker.instance_exec(value, self, &proc) else worker.instance_exec(value, &proc) end else value end end end end
Version data entries
5 entries across 5 versions & 2 rubygems