Sha256: 245345f70ab30f2ee891f21f32d4a8afd0e390a042ceeffbc5339a0ea0ae78c5

Contents?: true

Size: 639 Bytes

Versions: 4

Compression:

Stored size: 639 Bytes

Contents

class Describer
  attr_accessor :x, :y, :driver

  def initialize(params)
    ensure_required_params(params)
    self.x = params[:x]
    self.y = params[:y]
    self.driver = Driver.new(params)
  end

  def run
    driver.ensure_device_exists
    driver.describe_point(x, y)
  end

  def ensure_required_params(params)
    Logger.error('UDID should be provided') if params[:udid].nil?
    Logger.error('`x` point coordinate should be provided') if params[:x].nil? || params[:x].to_i.to_s != params[:x].to_s
    Logger.error('`y` point coordinate should be provided') if params[:y].nil? || params[:y].to_i.to_s != params[:y].to_s
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
xcmonkey-1.3.1 lib/xcmonkey/describer.rb
xcmonkey-1.3.0 lib/xcmonkey/describer.rb
xcmonkey-1.2.0 lib/xcmonkey/describer.rb
xcmonkey-1.1.0 lib/xcmonkey/describer.rb