Sha256: 9f50aa0bf86fce5d03ff6d988c60a6dbf734734064ea0d8771d44d78d852ec18

Contents?: true

Size: 873 Bytes

Versions: 19

Compression:

Stored size: 873 Bytes

Contents

module Calabash
  module Cucumber
    module QueryHelpers

      def escape_quotes(str)
        str.gsub("'", "\\\\'")
      end

      def point_from(query_result, options={})
        offset_x = 0
        offset_y = 0
        if options[:offset]
          offset_x += options[:offset][:x] || 0
          offset_y += options[:offset][:y] || 0
        end
        x = offset_x
        y = offset_y
        rect = query_result['rect'] || query_result[:rect]
        if rect
          x += rect['center_x'] || rect[:center_x] || rect[:x] || 0
          y += rect['center_y'] || rect[:center_y] || rect[:y] || 0
        else
          x += query_result['center_x'] || query_result[:center_x] || query_result[:x] || 0
          y += query_result['center_y'] || query_result[:center_y] || query_result[:y] || 0
        end

        {:x => x, :y => y}
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
calabash-cucumber-0.10.0.pre1 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.169 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.169.pre6 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.169.pre5 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.169.pre2 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.168 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.168.pre6 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.168.pre5 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.168.pre4 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.167 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.166 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.165 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.164 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.163 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.163.pre11 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.163.pre10 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.163.pre9 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.163.pre8 lib/calabash-cucumber/query_helpers.rb
calabash-cucumber-0.9.163.pre7 lib/calabash-cucumber/query_helpers.rb