Class: RemoveBg::Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



5
6
7
# File 'lib/remove_bg/configuration.rb', line 5

def api_key
  @api_key
end

#auto_upgrade_png_to_zipObject

Returns the value of attribute auto_upgrade_png_to_zip.



5
6
7
# File 'lib/remove_bg/configuration.rb', line 5

def auto_upgrade_png_to_zip
  @auto_upgrade_png_to_zip
end

#image_processorObject

Returns the value of attribute image_processor.



5
6
7
# File 'lib/remove_bg/configuration.rb', line 5

def image_processor
  @image_processor
end

Class Method Details

.configurationObject



7
8
9
10
11
12
13
14
# File 'lib/remove_bg/configuration.rb', line 7

def self.configuration
  @configuration ||= Configuration.new.tap do |config|
    config.image_processor = ImageComposer.detect_image_processor

    # Upgrade to ZIP where possible to save bandwith
    config.auto_upgrade_png_to_zip = true
  end
end

.resetObject



16
17
18
# File 'lib/remove_bg/configuration.rb', line 16

def self.reset
  @configuration = nil
end

Instance Method Details

#can_process_images?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/remove_bg/configuration.rb', line 20

def can_process_images?
  !image_processor.nil?
end