Class: Describer
- Inherits:
-
Object
- Object
- Describer
- Defined in:
- lib/xcmonkey/describer.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#udid ⇒ Object
Returns the value of attribute udid.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #ensure_required_params(params) ⇒ Object
-
#initialize(params) ⇒ Describer
constructor
A new instance of Describer.
- #run ⇒ Object
Constructor Details
#initialize(params) ⇒ Describer
Returns a new instance of Describer.
4 5 6 7 8 9 10 |
# File 'lib/xcmonkey/describer.rb', line 4 def initialize(params) ensure_required_params(params) self.udid = params[:udid] self.x = params[:x] self.y = params[:y] self.driver = Driver.new(params) end |
Instance Attribute Details
#driver ⇒ Object
Returns the value of attribute driver.
2 3 4 |
# File 'lib/xcmonkey/describer.rb', line 2 def driver @driver end |
#udid ⇒ Object
Returns the value of attribute udid.
2 3 4 |
# File 'lib/xcmonkey/describer.rb', line 2 def udid @udid end |
#x ⇒ Object
Returns the value of attribute x.
2 3 4 |
# File 'lib/xcmonkey/describer.rb', line 2 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
2 3 4 |
# File 'lib/xcmonkey/describer.rb', line 2 def y @y end |
Instance Method Details
#ensure_required_params(params) ⇒ Object
17 18 19 20 21 |
# File 'lib/xcmonkey/describer.rb', line 17 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 |
#run ⇒ Object
12 13 14 15 |
# File 'lib/xcmonkey/describer.rb', line 12 def run driver.ensure_device_exists driver.describe_point(x, y) end |