Sha256: bbf47a6e74ff18bae9241d6335426db39e5728e3a1828bd9c012ca9a7e1423ca

Contents?: true

Size: 661 Bytes

Versions: 11

Compression:

Stored size: 661 Bytes

Contents

# frozen_string_literal: true

# lib/region.rb
module Percy
  class Region
    attr_accessor :top, :bottom, :left, :right

    def initialize(top, bottom, left, right)
      raise ArgumentError, 'Only Positive integer is allowed!' if [top, bottom, left, right].any?(&:negative?)
      raise ArgumentError, 'Invalid ignore region parameters!' if top >= bottom || left >= right

      @top = top
      @bottom = bottom
      @left = left
      @right = right
    end

    def valid?(screen_height, screen_width)
      return false if @top >= screen_height || @bottom > screen_height || @left >= screen_width || @right > screen_width

      true
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
percy-appium-app-1.0.0 percy/lib/region.rb
percy-appium-app-0.0.8 percy/lib/region.rb
percy-appium-app-0.0.7 percy/lib/region.rb
percy-appium-app-0.0.6 percy/lib/region.rb
percy-appium-app-0.0.5 percy/lib/region.rb
percy-appium-app-0.0.5.pre.beta.1 percy/lib/region.rb
percy-appium-app-0.0.5.pre.beta.0 percy/lib/region.rb
percy-appium-app-0.0.4 percy/lib/region.rb
percy-appium-app-0.0.2.pre.beta.0 percy/lib/region.rb
percy-appium-app-0.0.3 percy/lib/region.rb
percy-appium-app-0.0.2 percy/lib/region.rb