padrino-support 0.13.3 → 0.13.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/padrino-support.rb +4 -4
- data/lib/padrino-support/utils.rb +11 -0
- data/test/test_utils.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d089c213dd819144c3f8667c4b783bcba84ffe
|
4
|
+
data.tar.gz: ba764bc92ef86ab5b1e4835006af84806eb30b76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f634f3097194ef1f71a5f03a614be4be6db5cd564fe9a9f315a8d43218c972568ae8de8a649b6d13e4be945e8a343a1ed9b50fe59f8be59abfc5f266358d4b9
|
7
|
+
data.tar.gz: e107ef8c84a337d6501f1df06ba4f96ab75b1169194238d99dcb9f7b6c2e520382927e570172c27cc84e6ec57f30f75c77f5ba1cb446d5d50987768455afd9dd
|
data/lib/padrino-support.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
##
|
2
2
|
# This file loads certain extensions required by Padrino from ActiveSupport.
|
3
3
|
#
|
4
|
-
require 'active_support/core_ext/hash/keys' # symbolize_keys
|
5
|
-
require 'active_support/core_ext/hash/indifferent_access' # params[:foo]
|
6
|
-
require 'active_support/core_ext/object/blank' # present?
|
7
|
-
require 'active_support/core_ext/string/output_safety' # SafeBuffer and html_safe
|
8
4
|
|
9
5
|
# Remove these on 0.14:
|
6
|
+
require 'active_support/core_ext/string/output_safety' # SafeBuffer and html_safe
|
7
|
+
require 'active_support/core_ext/object/blank' # present?
|
8
|
+
require 'active_support/core_ext/hash/keys' # symbolize_keys
|
9
|
+
require 'active_support/core_ext/hash/indifferent_access' # params[:foo]
|
10
10
|
require 'active_support/core_ext/hash/reverse_merge' # reverse_merge
|
11
11
|
require 'active_support/core_ext/module/aliasing' # alias_method_chain
|
12
12
|
require 'active_support/core_ext/array/extract_options' # Array#extract_options!
|
@@ -53,5 +53,16 @@ module Padrino
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Returns a Hash with keys turned into symbols.
|
59
|
+
#
|
60
|
+
def symbolize_keys(hash)
|
61
|
+
result = hash.class.new
|
62
|
+
hash.each_key do |key|
|
63
|
+
result[(key.to_sym rescue key)] = hash[key]
|
64
|
+
end
|
65
|
+
result
|
66
|
+
end
|
56
67
|
end
|
57
68
|
end
|
data/test/test_utils.rb
CHANGED
@@ -112,3 +112,13 @@ describe 'Padrino::Utils.deep_dup' do
|
|
112
112
|
assert_equal 1, dup.keys.length
|
113
113
|
end
|
114
114
|
end
|
115
|
+
|
116
|
+
describe 'Padrino::Utils.symbolize_keys' do
|
117
|
+
it 'should symbolize string keys' do
|
118
|
+
assert_equal({ :a => 1, :b => 2 }, Padrino::Utils.symbolize_keys('a' => 1, 'b' => 2))
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should not fail on non-symbolizable keys' do
|
122
|
+
assert_equal({ Object => 1, true => 2 }, Padrino::Utils.symbolize_keys(Object => 1, true => 2))
|
123
|
+
end
|
124
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.3
|
4
|
+
version: 0.13.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-08-
|
15
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: 1.3.6
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project: padrino-support
|
94
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.5.1
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Support for padrino
|