Class: Copyleaks::CopyleaksImageShapeModel

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/imageDetection/responses/CopyleaksImageShapeModel.rb

Overview

Dimensions of the analyzed image.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(height: nil, width: nil) ⇒ CopyleaksImageShapeModel

Initialize a new CopyleaksImageShapeModel

Parameters:

  • height (Integer) (defaults to: nil)

    Height of the image in pixels

  • width (Integer) (defaults to: nil)

    Width of the image in pixels



40
41
42
43
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksImageShapeModel.rb', line 40

def initialize(height: nil, width: nil)
  @height = height
  @width = width
end

Instance Attribute Details

#heightObject

Height of the image in pixels.



31
32
33
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksImageShapeModel.rb', line 31

def height
  @height
end

#widthObject

Width of the image in pixels.



34
35
36
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksImageShapeModel.rb', line 34

def width
  @width
end

Class Method Details

.from_json(json_hash) ⇒ Object

Create instance from JSON hash



46
47
48
49
50
51
52
53
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksImageShapeModel.rb', line 46

def self.from_json(json_hash)
  return nil if json_hash.nil?

  new(
    height: json_hash['height'],
    width: json_hash['width']
  )
end

Instance Method Details

#to_json(*args) ⇒ Object

Convert to JSON



56
57
58
59
60
61
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksImageShapeModel.rb', line 56

def to_json(*args)
  {
    'height' => @height,
    'width' => @width
  }.to_json(*args)
end