Sha256: 5418ccb6d0ec16f09f4f301ea8c960c073c5bc215740d861764b812c10e596c2

Contents?: true

Size: 473 Bytes

Versions: 2

Compression:

Stored size: 473 Bytes

Contents

module GoogleCells
  module Util

    def e(str)
      CGI.escapeHTML(str.to_s()).gsub(/\n/, '
')
    end

    def concat_url(url, piece)
      (url_base, url_query) = url.split(/\?/, 2)
      (piece_base, piece_query) = piece.split(/\?/, 2)
      result_query = [url_query, piece_query].select(){ |s| s && !s.empty? }.join("&")
      return (url_base || "") +
          (piece_base || "") +
          (result_query.empty? ? "" : "?#{result_query}")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
google-cells-0.4.0 lib/google_cells/util.rb
google-cells-0.3.0 lib/google_cells/util.rb