Class: Callisto::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/callisto/configuration.rb

Defined Under Namespace

Modules: Defaults

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



25
26
27
# File 'lib/callisto/configuration.rb', line 25

def initialize
  reset
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/callisto/configuration.rb', line 43

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

Instance Attribute Details

#thumbnail_defaultsObject

Returns the value of attribute thumbnail_defaults.



23
24
25
# File 'lib/callisto/configuration.rb', line 23

def thumbnail_defaults
  @thumbnail_defaults
end

Instance Method Details

#bin_path=(val) ⇒ Object



39
40
41
# File 'lib/callisto/configuration.rb', line 39

def bin_path=(val)
  Shell.bin_path = val
end

#max_workers=(val) ⇒ Object



35
36
37
# File 'lib/callisto/configuration.rb', line 35

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

#resetObject



29
30
31
32
33
# File 'lib/callisto/configuration.rb', line 29

def reset
  self.thumbnail_defaults = Defaults::THUMBNAIL.clone
  Pool.settings = Defaults::POOL.clone
  Shell.bin_path = Defaults::SHELL.clone[:bin_path]
end