Class: Applitools::Base::Dimension

Inherits:
Struct
  • Object
show all
Defined in:
lib/applitools/base/dimension.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#heightObject

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



2
3
4
# File 'lib/applitools/base/dimension.rb', line 2

def height
  @height
end

#widthObject

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



2
3
4
# File 'lib/applitools/base/dimension.rb', line 2

def width
  @width
end

Class Method Details

.for(other) ⇒ Object



31
32
33
# File 'lib/applitools/base/dimension.rb', line 31

def for(other)
  new(other.width, other.height)
end

Instance Method Details

#+(other) ⇒ Object



20
21
22
23
24
# File 'lib/applitools/base/dimension.rb', line 20

def +(other)
  self.width += other.width
  self.height += other.height
  self
end

#-(other) ⇒ Object



14
15
16
17
18
# File 'lib/applitools/base/dimension.rb', line 14

def -(other)
  self.width -= other.width
  self.height -= other.height
  self
end

#to_hashObject



3
4
5
6
7
8
# File 'lib/applitools/base/dimension.rb', line 3

def to_hash
  {
    width: width,
    height: height
  }
end

#to_sObject



26
27
28
# File 'lib/applitools/base/dimension.rb', line 26

def to_s
  values.to_s
end

#valuesObject



10
11
12
# File 'lib/applitools/base/dimension.rb', line 10

def values
  [width, height]
end