Class: Calabash::Android::Gestures::MultiTouchGesture
- Inherits:
-
Object
- Object
- Calabash::Android::Gestures::MultiTouchGesture
- Defined in:
- lib/calabash-android/gestures.rb
Instance Attribute Summary collapse
-
#gestures ⇒ Object
readonly
Returns the value of attribute gestures.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #+(gesture_collection) ⇒ Object
- #<<(gesture) ⇒ Object
- #add_gesture ⇒ Object
- #add_touch(touch, index = 0) ⇒ Object
- #add_touch!(touch, index = 0) ⇒ Object
-
#initialize(gestures = []) ⇒ MultiTouchGesture
constructor
A new instance of MultiTouchGesture.
- #max_execution_time ⇒ Object
- #merge(multi_touch_gesture) ⇒ Object
- #merge!(multi_touch_gesture) ⇒ Object
- #offset=(offset) ⇒ Object
- #query_string=(query_string) ⇒ Object
- #reset_query_string ⇒ Object
- #to_json(*object) ⇒ Object
Constructor Details
#initialize(gestures = []) ⇒ MultiTouchGesture
Returns a new instance of MultiTouchGesture.
11 12 13 14 15 16 17 18 |
# File 'lib/calabash-android/gestures.rb', line 11 def initialize(gestures = []) unless gestures.is_a?(Array) gestures = [gestures] end @gestures = gestures @timeout = Calabash::Android::Defaults.query_timeout end |
Instance Attribute Details
#gestures ⇒ Object (readonly)
Returns the value of attribute gestures.
8 9 10 |
# File 'lib/calabash-android/gestures.rb', line 8 def gestures @gestures end |
#timeout ⇒ Object
Returns the value of attribute timeout.
9 10 11 |
# File 'lib/calabash-android/gestures.rb', line 9 def timeout @timeout end |
Instance Method Details
#+(gesture_collection) ⇒ Object
20 21 22 |
# File 'lib/calabash-android/gestures.rb', line 20 def +(gesture_collection) MultiTouchGesture.new(@gestures + gesture_collection.gestures) end |
#<<(gesture) ⇒ Object
29 30 31 |
# File 'lib/calabash-android/gestures.rb', line 29 def <<(gesture) @gestures << gesture end |
#add_gesture ⇒ Object
24 25 26 27 |
# File 'lib/calabash-android/gestures.rb', line 24 def add_gesture gestures = @gestures MultiTouchGesture.new(gestures + gesture_collection.gestures) end |
#add_touch(touch, index = 0) ⇒ Object
33 34 35 36 37 |
# File 'lib/calabash-android/gestures.rb', line 33 def add_touch(touch, index=0) gestures = @gestures gestures[index] << touch MultiTouchGesture.new(gestures) end |
#add_touch!(touch, index = 0) ⇒ Object
39 40 41 |
# File 'lib/calabash-android/gestures.rb', line 39 def add_touch!(touch, index=0) @gestures = add_touch(touch, index).gestures end |
#max_execution_time ⇒ Object
70 71 72 |
# File 'lib/calabash-android/gestures.rb', line 70 def max_execution_time (@gestures.map {|gesture| gesture.max_execution_time}).max end |
#merge(multi_touch_gesture) ⇒ Object
43 44 45 |
# File 'lib/calabash-android/gestures.rb', line 43 def merge(multi_touch_gesture) MultiTouchGesture.new(gestures.map.with_index {|gesture, index| gesture + multi_touch_gesture.gestures[index]}) end |
#merge!(multi_touch_gesture) ⇒ Object
47 48 49 |
# File 'lib/calabash-android/gestures.rb', line 47 def merge!(multi_touch_gesture) @gestures = merge(multi_touch_gesture).gestures end |
#offset=(offset) ⇒ Object
66 67 68 |
# File 'lib/calabash-android/gestures.rb', line 66 def offset=(offset) @gestures.each {|gesture| gesture.offset=offset} end |
#query_string=(query_string) ⇒ Object
58 59 60 |
# File 'lib/calabash-android/gestures.rb', line 58 def query_string=(query_string) @gestures.each {|gesture| gesture.query_string=query_string} end |
#reset_query_string ⇒ Object
62 63 64 |
# File 'lib/calabash-android/gestures.rb', line 62 def reset_query_string @gestures.each {|gesture| gesture.reset_query_string} end |
#to_json(*object) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/calabash-android/gestures.rb', line 51 def to_json(*object) { query_timeout: @timeout.to_f, gestures: @gestures }.to_json(*object) end |