Class: Applitools::FloatingBounds

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_left_offset, max_top_offset, max_right_offset, max_bottom_offset) ⇒ FloatingBounds

Returns a new instance of FloatingBounds.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/applitools/core/floating_region.rb', line 112

def initialize(max_left_offset, max_top_offset, max_right_offset, max_bottom_offset)
  Applitools::ArgumentGuard.is_a?(max_left_offset, 'max_left_offset', Integer)
  Applitools::ArgumentGuard.is_a?(max_top_offset, 'max_top_offset', Integer)
  Applitools::ArgumentGuard.is_a?(max_right_offset, 'max_right_offset', Integer)
  Applitools::ArgumentGuard.is_a?(max_bottom_offset, 'max_bottom_offset', Integer)

  Applitools::ArgumentGuard.greater_than_or_equal_to_zero(max_left_offset, 'max_left_offset')
  Applitools::ArgumentGuard.greater_than_or_equal_to_zero(max_top_offset, 'max_top_offset')
  Applitools::ArgumentGuard.greater_than_or_equal_to_zero(max_right_offset, 'max_right_offset')
  Applitools::ArgumentGuard.greater_than_or_equal_to_zero(max_bottom_offset, 'max_bottom_offset')

  self.max_left_offset = max_left_offset
  self.max_top_offset = max_top_offset
  self.max_right_offset = max_right_offset
  self.max_bottom_offset = max_bottom_offset
end

Instance Attribute Details

#max_bottom_offsetObject

Returns the value of attribute max_bottom_offset.



111
112
113
# File 'lib/applitools/core/floating_region.rb', line 111

def max_bottom_offset
  @max_bottom_offset
end

#max_left_offsetObject

Returns the value of attribute max_left_offset.



111
112
113
# File 'lib/applitools/core/floating_region.rb', line 111

def max_left_offset
  @max_left_offset
end

#max_right_offsetObject

Returns the value of attribute max_right_offset.



111
112
113
# File 'lib/applitools/core/floating_region.rb', line 111

def max_right_offset
  @max_right_offset
end

#max_top_offsetObject

Returns the value of attribute max_top_offset.



111
112
113
# File 'lib/applitools/core/floating_region.rb', line 111

def max_top_offset
  @max_top_offset
end

Instance Method Details

#to_hashObject



129
130
131
132
133
134
135
136
137
138
# File 'lib/applitools/core/floating_region.rb', line 129

def to_hash
  {
    offset: {
      top: max_top_offset,
      bottom: max_bottom_offset,
      left: max_left_offset,
      right: max_right_offset
    }
  }
end