Sha256: e8358c0614d141df1d2804da1476cb3c13d7080e6c75b4d0b1513749292b5745

Contents?: true

Size: 382 Bytes

Versions: 2

Compression:

Stored size: 382 Bytes

Contents

# frozen_string_literal: true

module HardCider
  module Utils
    # @param hash [Hash]
    # @return [Hash]
    def self.underscore_keys(hash)
      hash.map { |k, v| [underscore(k), v] }.to_h
    end

    # @param string_or_symbol [String|Symbol]
    # @return [Symbol]
    def self.underscore(string_or_symbol)
      string_or_symbol.to_s.gsub('-', '_').to_sym
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hard_cider-0.3.0 lib/hard_cider/utils.rb
hard_cider-0.2.0 lib/hard_cider/utils.rb