libis-tools 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libis/tools/extend/hash.rb +16 -2
- data/lib/libis/tools/extend/ostruct.rb +1 -2
- data/lib/libis/tools/extend/string.rb +36 -2
- data/lib/libis/tools/extend/struct.rb +1 -2
- data/lib/libis/tools/logger.rb +0 -1
- data/lib/libis/tools/version.rb +1 -1
- data/libis-tools.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b272e715eada957c71274b805c3cc13ddef2201f6d1eaa6ae23b9f19c9da6396
|
4
|
+
data.tar.gz: 320cedbee54192c465006a77f4e98e2d415e3ab15dfd250e1101774bc8d0c686
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bfdde16320124ab7ca2fddfcc7dc17ed019bade21f118bd81a0f0179d7b1258ed4890419e277d7ba8517c73b6e6216cd06adf71b5a80316930b33a47d27e120
|
7
|
+
data.tar.gz: 22f5c05ddfe99203e30a7aae5e66010e42f9e6342bc605a21c49da288a860d39ce6f56825e62b11c15dad8497d965fe350771d47a6d684badcd6cda48c54d830
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'backports/rails/hash'
|
2
|
-
|
3
1
|
# Extension class for Hash
|
4
2
|
class Hash
|
5
3
|
|
@@ -56,6 +54,14 @@ class Hash
|
|
56
54
|
self.merge!(other_hash) {|_,v, w| v.blank? ? w : v}
|
57
55
|
end unless method_defined? :apply_defaults!
|
58
56
|
|
57
|
+
def symbolize_keys
|
58
|
+
self.transform_keys {|k| k.to_sym}
|
59
|
+
end unless method_defined? :symbolize_keys
|
60
|
+
|
61
|
+
def symbolize_keys!
|
62
|
+
self.transform_keys! {|k| k.to_sym}
|
63
|
+
end unless method_defined? :symbolize_keys!
|
64
|
+
|
59
65
|
# Convert all keys to symbols. In-place operation.
|
60
66
|
# @param (see #key_strings_to_symbols)
|
61
67
|
def key_strings_to_symbols!(options = {})
|
@@ -101,6 +107,14 @@ class Hash
|
|
101
107
|
r
|
102
108
|
end unless method_defined? :key_strings_to_symbols
|
103
109
|
|
110
|
+
def stringify_keys
|
111
|
+
self.transform_keys {|k| k.to_s}
|
112
|
+
end unless method_defined? :stringify_keys
|
113
|
+
|
114
|
+
def stringify_keys!
|
115
|
+
self.transform_keys! {|k| k.to_s}
|
116
|
+
end unless method_defined? :stringify_keys!
|
117
|
+
|
104
118
|
# Convert all keys to strings. In-place operation.
|
105
119
|
# (@see #key_symbols_to_strings)
|
106
120
|
# @param (see #key_symbols_to_strings)
|
@@ -1,8 +1,42 @@
|
|
1
|
-
require 'backports/rails/string'
|
2
|
-
|
3
1
|
# Extension class
|
4
2
|
class String
|
5
3
|
|
4
|
+
# from activesupport
|
5
|
+
def camelize(first_letter = :upper)
|
6
|
+
if first_letter == :upper
|
7
|
+
gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
8
|
+
else
|
9
|
+
self[0..0].downcase + camelize[1..-1]
|
10
|
+
end
|
11
|
+
end unless method_defined? :camelize
|
12
|
+
|
13
|
+
def constantize
|
14
|
+
names = split('::')
|
15
|
+
names.shift if names.empty? || names.first.empty?
|
16
|
+
|
17
|
+
constant = Object
|
18
|
+
names.each do |name|
|
19
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
20
|
+
end
|
21
|
+
constant
|
22
|
+
end unless method_defined? :constantize
|
23
|
+
|
24
|
+
def dasherize
|
25
|
+
gsub(/_/, '-')
|
26
|
+
end unless method_defined? :dasherize
|
27
|
+
|
28
|
+
def demodulize
|
29
|
+
gsub(/^.*::/, '')
|
30
|
+
end unless method_defined? :demodulize
|
31
|
+
|
32
|
+
def underscore
|
33
|
+
gsub(/::/, '/').
|
34
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
35
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
36
|
+
tr("-", "_").
|
37
|
+
downcase
|
38
|
+
end unless method_defined? :underscore
|
39
|
+
|
6
40
|
# Check if string is empty
|
7
41
|
def blank?
|
8
42
|
self == ''
|
data/lib/libis/tools/logger.rb
CHANGED
data/lib/libis/tools/version.rb
CHANGED
data/libis-tools.gemspec
CHANGED
@@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency 'equivalent-xml', '~> 0.5'
|
37
37
|
spec.add_development_dependency 'awesome_print', '~> 1.6'
|
38
38
|
|
39
|
-
spec.add_runtime_dependency 'backports', '~> 3.6'
|
40
39
|
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
41
40
|
spec.add_runtime_dependency 'gyoku', '~> 1.3'
|
42
41
|
spec.add_runtime_dependency 'nori', '~> 2.6'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.6'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: backports
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '3.6'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '3.6'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: nokogiri
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|