Sha256: 732bda123093509eaed1efba00153c591e8da4d7997e4d424e7589dcc533a1bb

Contents?: true

Size: 421 Bytes

Versions: 4

Compression:

Stored size: 421 Bytes

Contents

# frozen_string_literal: true
module  Drillbit
class   Parameters
  attr_accessor :query_string

  def initialize(query_string)
    self.query_string = query_string
  end

  def self.process(query_string)
    new(query_string).process
  end

  def process
    return query_string unless query_string.respond_to? :gsub

    query_string.gsub(/(?<=\A|&|\?)[^=&]+/) do |match|
      match.tr('-', '_')
    end
  end
end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
drillbit-1.1.0 lib/drillbit/parameters.rb
drillbit-1.0.1 lib/drillbit/parameters.rb
drillbit-1.0.0 lib/drillbit/parameters.rb
drillbit-0.0.1 lib/drillbit/parameters.rb