Class: Applitools::PaddingBounds

Inherits:
Object
  • Object
show all
Defined in:
lib/applitools/core/padding_bounds.rb

Constant Summary collapse

ZERO_PADDING =
PaddingBounds.new(0, 0, 0, 0).freeze
PIXEL_PADDING =
PaddingBounds.new(1, 1, 1, 1).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(padding_left, padding_top, padding_right, padding_bottom) ⇒ PaddingBounds

Returns a new instance of PaddingBounds.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/applitools/core/padding_bounds.rb', line 7

def initialize(padding_left, padding_top, padding_right, padding_bottom)
  Applitools::ArgumentGuard.is_a?(padding_left, 'padding_left', Integer)
  Applitools::ArgumentGuard.is_a?(padding_top, 'padding_top', Integer)
  Applitools::ArgumentGuard.is_a?(padding_right, 'padding_right', Integer)
  Applitools::ArgumentGuard.is_a?(padding_bottom, 'padding_bottom', Integer)

  Applitools::ArgumentGuard.greater_than_or_equal_to_zero(padding_left, 'padding_left')
  Applitools::ArgumentGuard.greater_than_or_equal_to_zero(padding_top, 'padding_top')
  Applitools::ArgumentGuard.greater_than_or_equal_to_zero(padding_right, 'padding_right')
  Applitools::ArgumentGuard.greater_than_or_equal_to_zero(padding_bottom, 'padding_bottom')

  self.padding_left = padding_left
  self.padding_top = padding_top
  self.padding_right = padding_right
  self.padding_bottom = padding_bottom
end

Instance Attribute Details

#padding_bottomObject

Returns the value of attribute padding_bottom.



6
7
8
# File 'lib/applitools/core/padding_bounds.rb', line 6

def padding_bottom
  @padding_bottom
end

#padding_leftObject

Returns the value of attribute padding_left.



6
7
8
# File 'lib/applitools/core/padding_bounds.rb', line 6

def padding_left
  @padding_left
end

#padding_rightObject

Returns the value of attribute padding_right.



6
7
8
# File 'lib/applitools/core/padding_bounds.rb', line 6

def padding_right
  @padding_right
end

#padding_topObject

Returns the value of attribute padding_top.



6
7
8
# File 'lib/applitools/core/padding_bounds.rb', line 6

def padding_top
  @padding_top
end

Instance Method Details

#to_hashObject



27
28
29
30
31
32
33
34
# File 'lib/applitools/core/padding_bounds.rb', line 27

def to_hash
  {
    left: padding_left,
    top: padding_top,
    right: padding_right,
    bottom: padding_bottom
  }
end