Sha256: 29aac5e29e91dd62bdff895ff9550faf5ed92eb68edf18806119ea951287a142

Contents?: true

Size: 342 Bytes

Versions: 34

Compression:

Stored size: 342 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

# encoding=utf-8

# hash with keys sorted by name
# add Hash.sym_keys
#
class Hash
  unless defined?(sort_by_key)
    def sort_by_key
      keys.sort.to_h { |key| [key, self[key]] }
    end
  end

  unless defined?(sym_keys)
    def sym_keys
      transform_keys(&:to_sym)
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
markdown_exec-2.7.2 lib/hash.rb
markdown_exec-2.7.1 lib/hash.rb
markdown_exec-2.7.0 lib/hash.rb
markdown_exec-2.6.0 lib/hash.rb
markdown_exec-2.5.0 lib/hash.rb
markdown_exec-2.4.0 lib/hash.rb
markdown_exec-2.3.0 lib/hash.rb
markdown_exec-2.2.0 lib/hash.rb
markdown_exec-2.1.0 lib/hash.rb
markdown_exec-2.0.8.4 lib/hash.rb
markdown_exec-2.0.8.3 lib/hash.rb
markdown_exec-2.0.8.2 lib/hash.rb
markdown_exec-2.0.8.1 lib/hash.rb
markdown_exec-2.0.8 lib/hash.rb
markdown_exec-2.0.7 lib/hash.rb
markdown_exec-2.0.6 lib/hash.rb
markdown_exec-2.0.5 lib/hash.rb
markdown_exec-2.0.4 lib/hash.rb
markdown_exec-2.0.3.2 lib/hash.rb
markdown_exec-2.0.3.1 lib/hash.rb