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

Methods included from FluentInterface

#ignore_caret, #ignore_mismatch, included, #match_level, #timeout, #trim

Methods included from MatchLevelSetter

#match_level_with_exact

Constructor Details

#initializeTarget

Returns a new instance of Target.



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

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.



6
7
8
# File 'lib/applitools/calabash/target.rb', line 6

def floating_regions
  @floating_regions
end

#ignored_regionsObject

Returns the value of attribute ignored_regions.



6
7
8
# File 'lib/applitools/calabash/target.rb', line 6

def ignored_regions
  @ignored_regions
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/applitools/calabash/target.rb', line 6

def options
  @options
end

#region_to_checkObject

Returns the value of attribute region_to_check.



6
7
8
# File 'lib/applitools/calabash/target.rb', line 6

def region_to_check
  @region_to_check
end

Instance Method Details

#fullyObject



16
17
18
19
# File 'lib/applitools/calabash/target.rb', line 16

def fully
  options[:stitch_content] = true
  self
end

#ignore(region = nil) ⇒ Object



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

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



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

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