Class: Applitools::Calabash::Target

Inherits:
Object
  • Object
show all
Includes:
FluentInterface
Defined in:
lib/applitools/calabash/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTarget

Returns a new instance of Target.



10
11
12
13
14
15
16
# File 'lib/applitools/calabash/target.rb', line 10

def initialize
  self.ignored_regions = []
  self.floating_regions = []
  self.options = {
    trim: false
  }
end

Instance Attribute Details

#floating_regionsObject

Returns the value of attribute floating_regions.



8
9
10
# File 'lib/applitools/calabash/target.rb', line 8

def floating_regions
  @floating_regions
end

#ignored_regionsObject

Returns the value of attribute ignored_regions.



8
9
10
# File 'lib/applitools/calabash/target.rb', line 8

def ignored_regions
  @ignored_regions
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/applitools/calabash/target.rb', line 8

def options
  @options
end

#region_to_checkObject

Returns the value of attribute region_to_check.



8
9
10
# File 'lib/applitools/calabash/target.rb', line 8

def region_to_check
  @region_to_check
end

Instance Method Details

#fullyObject



18
19
20
21
# File 'lib/applitools/calabash/target.rb', line 18

def fully
  options[:stitch_content] = true
  self
end

#ignore(region = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/applitools/calabash/target.rb', line 23

def ignore(region = nil)
  if region
    Applitools::ArgumentGuard.is_a? region, 'region', Applitools::Calabash::CalabashElement
    ignored_regions << region.region
  else
    self.ignored_regions = []
  end
  self
end

#region(region = nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/applitools/calabash/target.rb', line 33

def region(region = nil)
  if region
    case region
    when Applitools::Calabash::CalabashElement, Applitools::Region
      self.region_to_check = region
    else
      self.region_to_check = nil
      raise(
        Applitools::EyesIllegalArgument,
        'Expected region to be instance of Applitools::Calabash::CalabashElement or Applitools::Region'
      )
    end
  else
    self.region_to_check = nil
  end
  self
end