Class: Motion::Device

Inherits:
Struct
  • Object
show all
Defined in:
lib/motion/devices.rb

Instance Attribute 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/motion/devices.rb', line 2

def height
  @height
end

#landscapeObject

Returns the value of attribute landscape

Returns:

  • (Object)

    the current value of landscape



2
3
4
# File 'lib/motion/devices.rb', line 2

def landscape
  @landscape
end

#no_height_labelObject

Returns the value of attribute no_height_label

Returns:

  • (Object)

    the current value of no_height_label



2
3
4
# File 'lib/motion/devices.rb', line 2

def no_height_label
  @no_height_label
end

#scaleObject

Returns the value of attribute scale

Returns:

  • (Object)

    the current value of scale



2
3
4
# File 'lib/motion/devices.rb', line 2

def scale
  @scale
end

#widthObject

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



2
3
4
# File 'lib/motion/devices.rb', line 2

def width
  @width
end

Instance Method Details

#check_screenshots_existsObject



20
21
22
23
# File 'lib/motion/devices.rb', line 20

def check_screenshots_exists
  check_screenshot_exists(:portrait)
  check_screenshot_exists(:landscape) if landscape
end

#filename(orientation) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/motion/devices.rb', line 3

def filename(orientation)
  if orientation == :portrait
    size_measurement = height/scale
    orientation_label = landscape ? '-Portrait' : ''
  elsif orientation == :landscape
    size_measurement = width/scale
    orientation_label = '-Landscape'
  end
  size_label = no_height_label ? '' : "-#{size_measurement}h"

  "Default#{orientation_label}#{size_label}@#{scale}x.png"
end

#filepath(orientation) ⇒ Object



16
17
18
# File 'lib/motion/devices.rb', line 16

def filepath(orientation)
  "#{get_screenshot_path}#{filename(orientation)}"
end