Module: Picguard

Defined in:
lib/picguard.rb,
lib/configuration.rb,
lib/picguard/version.rb

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

VERSION =
"1.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



13
14
15
# File 'lib/picguard.rb', line 13

def configuration
  @configuration
end

Class Method Details

.analyze(image_path:, safe_search: true, face_detection: true, threshold_adult: Picguard.configuration.threshold_adult, threshold_violence: Picguard.configuration.threshold_violence, threshold_face: Picguard.configuration.threshold_face) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/picguard.rb', line 21

def self.analyze(image_path:,
                 safe_search: true,
                 face_detection: true,
                 threshold_adult: Picguard.configuration.threshold_adult,
                 threshold_violence: Picguard.configuration.threshold_violence,
                 threshold_face: Picguard.configuration.threshold_face
                 )

  prepared_image_path = Services::ImagePreparator.new(image_path, face_detection, safe_search).call

  Services::Analyzer.new(
    Services::Builders::Request.new(
      prepared_image_path, safe_search, face_detection
    ).call,
    threshold_adult,
    threshold_violence,
    threshold_face
  ).call
end

.configure {|configuration| ... } ⇒ Object

Yields:



16
17
18
19
# File 'lib/picguard.rb', line 16

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end