Class: Applitools::DynamicRegion

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

Constant Summary

Constants inherited from Region

Region::DEFAULT_SUBREGIONS_INTERSECTION, Region::EMPTY

Instance Attribute Summary collapse

Attributes inherited from Region

#height, #left, #padding, #top, #width

Instance Method Summary collapse

Methods inherited from Region

#[], #bottom, #contains?, #current_padding, #empty?, from_location_size, #intersect, #intersecting?, #location, #location=, #make_empty, #middle_offset, #right, #scale_it!, #size, #size_equals?, #sub_regions, sub_regions_with_fixed_size, sub_regions_with_varying_size, #to_s, #with_padding

Constructor Details

#initialize(element, region_type) ⇒ DynamicRegion

Returns a new instance of DynamicRegion.



8
9
10
11
# File 'lib/applitools/core/dynamic_region.rb', line 8

def initialize(element, region_type)
  super(element.location.x, element.location.y, element.size.width, element.size.height)
  self.region_type = region_type
end

Instance Attribute Details

#region_typeObject

Returns the value of attribute region_type.



7
8
9
# File 'lib/applitools/core/dynamic_region.rb', line 7

def region_type
  @region_type
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
# File 'lib/applitools/core/dynamic_region.rb', line 23

def ==(other)
  super && region_type == other.region_type
end

#to_hashObject Also known as: json_data



13
14
15
16
17
18
19
# File 'lib/applitools/core/dynamic_region.rb', line 13

def to_hash
  if region_type
    super.merge(type: region_type)
  else
    super
  end
end