Sha256: 79a9fdfe7faa06009b79b8892a83bdc842604d29ad4e5ed67bb11a24a2bdc5c8
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
module Calabash # @!visibility private class AbstractMethodError < StandardError end # @!visibility private module Utility # @!visibility private def abstract_method! method_name = if Kernel.method_defined?(:caller_locations) caller_locations.first.label else caller.first[/\`(.*)\'/, 1] end raise AbstractMethodError.new("Abstract method '#{method_name}'") end # @!visibility private class RetryError < RuntimeError; end # A convenience method for creating a percentage hash that that can be # passed to gestures. # # @example # # These are equivalent. # pan(percent(20, 50), percent(20, 100)) # pan({x: 20, y: 50}, {x: 20, y: 100}) # # @param [Number] x The value of the x percent. # @param [Number] y The value of the y percent. # @return [Hash] Representing the given values. def percent(x, y) {x: x, y: y} end alias_method :pct, :percent # A convenience method for creating a coordinate hash that that can be # passed to gestures. # # @example # # These are equivalent. # tap(query, offset: coordinate(20, 50)) # tap(query, offset: {x: 20, y: 50}) # # @param [Number] x The value of the x. # @param [Number] y The value of the y. # @return [Hash] Representing the given values. def coordinate(x, y) {x: x, y: y} end alias_method :coord, :coordinate end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
calabash-1.9.9.pre3 | lib/calabash/utility.rb |