Module: Kirigami::Configuration

Included in:
Kirigami
Defined in:
lib/kirigami/configuration.rb

Constant Summary collapse

IMAGE_EXTENSIONS =
%w[ png jpg jpeg gif ]
EXCLUDE_PATHS =
[]
SAFE_MODE =
true
JPEG_COMPRESSION_QUALITY =
'85%'.freeze
JPEG_COLORSPACE =
'RGB'.freeze
JPEG_SAMPLING_FACTOR =
"4:2:0".freeze
JPEG_INTERLACING =
"Plane".freeze
DEBUG =
false

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/kirigami/configuration.rb', line 38

def self.extended(klass)
  klass.class_eval do
    include ActiveSupport::Configurable

    config.image_extensions ||= IMAGE_EXTENSIONS

    config.image_paths  ||= Array(rails_image_paths)

    config.exclude_paths ||= EXCLUDE_PATHS

    config.safe_mode ||= SAFE_MODE

    config.jpeg_compression_quality ||= JPEG_COMPRESSION_QUALITY

    config.jpeg_colorspace ||= JPEG_COLORSPACE

    config.jpeg_sampling_factor ||= JPEG_SAMPLING_FACTOR

    config.jpeg_interlacing ||= JPEG_INTERLACING

    MiniMagick.configure do |magick|
      magick.debug = Logger::DEBUG if config.debug
    end

  end
end

Instance Method Details

#loggerObject



65
66
67
# File 'lib/kirigami/configuration.rb', line 65

def logger
  @logger ||= Logger.new($stdout, level: config.debug ? Logger::DEBUG : Logger::INFO)
end