Class: Calabash::Android::Gestures::MultiTouchGesture
- Inherits:
-
Object
- Object
- Calabash::Android::Gestures::MultiTouchGesture
- Defined in:
- lib/calabash-android/gestures.rb
Constant Summary collapse
- DEFAULT_TIMEOUT =
5
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.
12 13 14 15 16 17 18 19 |
# File 'lib/calabash-android/gestures.rb', line 12 def initialize(gestures = []) unless gestures.is_a?(Array) gestures = [gestures] end @gestures = gestures @timeout = (ENV['CALABASH_DEFAULT_TIMEOUT'] && ENV['CALABASH_DEFAULT_TIMEOUT'].to_i) || DEFAULT_TIMEOUT end |
Instance Attribute Details
#gestures ⇒ Object (readonly)
Returns the value of attribute gestures.
7 8 9 |
# File 'lib/calabash-android/gestures.rb', line 7 def gestures @gestures end |
#timeout ⇒ Object
Returns the value of attribute timeout.
8 9 10 |
# File 'lib/calabash-android/gestures.rb', line 8 def timeout @timeout end |
Instance Method Details
#+(gesture_collection) ⇒ Object
21 22 23 |
# File 'lib/calabash-android/gestures.rb', line 21 def +(gesture_collection) MultiTouchGesture.new(@gestures + gesture_collection.gestures) end |
#<<(gesture) ⇒ Object
30 31 32 |
# File 'lib/calabash-android/gestures.rb', line 30 def <<(gesture) @gestures << gesture end |
#add_gesture ⇒ Object
25 26 27 28 |
# File 'lib/calabash-android/gestures.rb', line 25 def add_gesture gestures = @gestures MultiTouchGesture.new(gestures + gesture_collection.gestures) end |
#add_touch(touch, index = 0) ⇒ Object
34 35 36 37 38 |
# File 'lib/calabash-android/gestures.rb', line 34 def add_touch(touch, index=0) gestures = @gestures gestures[index] << touch MultiTouchGesture.new(gestures) end |
#add_touch!(touch, index = 0) ⇒ Object
40 41 42 |
# File 'lib/calabash-android/gestures.rb', line 40 def add_touch!(touch, index=0) @gestures = add_touch(touch, index).gestures end |
#max_execution_time ⇒ Object
71 72 73 |
# File 'lib/calabash-android/gestures.rb', line 71 def max_execution_time (@gestures.map {|gesture| gesture.max_execution_time}).max end |
#merge(multi_touch_gesture) ⇒ Object
44 45 46 |
# File 'lib/calabash-android/gestures.rb', line 44 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
48 49 50 |
# File 'lib/calabash-android/gestures.rb', line 48 def merge!(multi_touch_gesture) @gestures = merge(multi_touch_gesture).gestures end |
#offset=(offset) ⇒ Object
67 68 69 |
# File 'lib/calabash-android/gestures.rb', line 67 def offset=(offset) @gestures.each {|gesture| gesture.offset=offset} end |
#query_string=(query_string) ⇒ Object
59 60 61 |
# File 'lib/calabash-android/gestures.rb', line 59 def query_string=(query_string) @gestures.each {|gesture| gesture.query_string=query_string} end |
#reset_query_string ⇒ Object
63 64 65 |
# File 'lib/calabash-android/gestures.rb', line 63 def reset_query_string @gestures.each {|gesture| gesture.reset_query_string} end |
#to_json(*object) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/calabash-android/gestures.rb', line 52 def to_json(*object) { query_timeout: @timeout.to_f, gestures: @gestures }.to_json(*object) end |