Sha256: bf2cdcfa3f992cdd3b2d548c6db169d27459a8f7fa6ccd94901d03ae5c8d730a

Contents?: true

Size: 421 Bytes

Versions: 3

Compression:

Stored size: 421 Bytes

Contents

# frozen_string_literal: true
module Aitch
  module Utils extend self
    def underscore(string)
      string = string.gsub(/(?<=.)(URI|[A-Z])/) do |char|
        "_#{char}"
      end

      string.downcase
    end

    def symbolize_keys(hash)
      hash.each_with_object({}) do |(key, value), buffer|
        buffer[key.to_sym] = value
      end
    end

    def build_query(data)
      data.to_query
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aitch-1.0.2 lib/aitch/utils.rb
aitch-1.0.1 lib/aitch/utils.rb
aitch-1.0.0 lib/aitch/utils.rb