Module: GDCM::Configuration

Included in:
GDCM
Defined in:
lib/gdcm/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#debugBoolean (readonly)

When get to ‘true`, it outputs each command to STDOUT in their shell version.

Returns:

  • (Boolean)


19
20
21
# File 'lib/gdcm/configuration.rb', line 19

def debug
  @debug
end

#loggerLogger

Logger for #debug, default is ‘GDCM::Logger.new(STDOUT)`, but you can override it, for example if you want the logs to be written to a file.

Returns:

  • (Logger)


27
28
29
# File 'lib/gdcm/configuration.rb', line 27

def logger
  @logger
end

#shell_apiString

Instructs GDCM how to execute the shell commands. Available APIs are “open3” (default) and “posix-spawn” (requires the “posix-spawn” gem).

Returns:

  • (String)


55
56
57
# File 'lib/gdcm/configuration.rb', line 55

def shell_api
  @shell_api
end

#timeoutInteger

If you don’t want commands to take too long, you can set a timeout (in seconds).

Returns:

  • (Integer)


12
13
14
# File 'lib/gdcm/configuration.rb', line 12

def timeout
  @timeout
end

#validate_on_createBoolean

If set to ‘true`, it will `identify` every newly created image, and raise `MiniMagick::Invalid` if the image is not valid. Useful for validating user input, although it adds a bit of overhead. Defaults to `true`.

Returns:

  • (Boolean)


36
37
38
# File 'lib/gdcm/configuration.rb', line 36

def validate_on_create
  @validate_on_create
end

#whinyObject

Returns the value of attribute whiny.



46
47
48
# File 'lib/gdcm/configuration.rb', line 46

def whiny
  @whiny
end

Class Method Details

.extended(base) ⇒ Object



57
58
59
60
61
62
# File 'lib/gdcm/configuration.rb', line 57

def self.extended(base)
  base.validate_on_create = true
  base.whiny = true
  base.shell_api = "open3"
  base.logger = Logger.new($stdout).tap { |l| l.level = Logger::INFO }
end

Instance Method Details

#configure {|self| ... } ⇒ Object

Examples:

GDCM.configure do |config|
  config.timeout = 5
end

Yields:

  • (self)


71
72
73
# File 'lib/gdcm/configuration.rb', line 71

def configure
  yield self
end