markdown_exec 1.6 → 1.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/hash.rb ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # encoding=utf-8
5
+
6
+ # hash with keys sorted by name
7
+ # add Hash.sym_keys
8
+ #
9
+ class Hash
10
+ unless defined?(sort_by_key)
11
+ def sort_by_key
12
+ keys.sort.to_h { |key| [key, self[key]] }
13
+ end
14
+ end
15
+
16
+ unless defined?(sym_keys)
17
+ def sym_keys
18
+ transform_keys(&:to_sym)
19
+ end
20
+ end
21
+ end