Sha256: 7786418ebedbd657f20372a7ae2544904be7d0e3c71869d675da8c7678b4558d

Contents?: true

Size: 404 Bytes

Versions: 4

Compression:

Stored size: 404 Bytes

Contents

module Clickhouse
  module Utils
    extend self

    def normalize_url(url)
      if url.match(/^\w+:\/\//)
        url
      else
        "#{Clickhouse::Connection::DEFAULT_CONFIG[:scheme]}://#{url}"
      end
    end

    def extract_format(query)
      format = nil
      query = query.gsub(/ FORMAT (\w+)/i) do
        format = $1
        ""
      end
      [query.strip, format]
    end

  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
ch-client-0.0.1 lib/clickhouse/utils.rb
clickhouse-0.1.10 lib/clickhouse/utils.rb
clickhouse-0.1.9 lib/clickhouse/utils.rb
clickhouse-0.1.8 lib/clickhouse/utils.rb