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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 614880562757e58d8f1e86db7f507411a873c7920efcc3b932dd446b65eb7a70
4
- data.tar.gz: c8aa877ea6b7fcc8daec5f2c1e49d5680afd857e900c6b8e6f5a309e884858e9
3
+ metadata.gz: b272e715eada957c71274b805c3cc13ddef2201f6d1eaa6ae23b9f19c9da6396
4
+ data.tar.gz: 320cedbee54192c465006a77f4e98e2d415e3ab15dfd250e1101774bc8d0c686
5
5
  SHA512:
6
- metadata.gz: 8907c8cdb69831d8bfcf432d47d2abf06bb010e8aa6aac8a20e125cbfa1487df3a3b1db2fb3e4da7c77533f34b78377bfec929c4d3c5f5d79e747f11a54c0c8b
7
- data.tar.gz: e7536a051acb0cfe862cca95799c1b9b8653f06cc550ffc30cde1a9c5a21a044bb4c5a4d9183a0099cd31b27f0615f8c4fb72e53f03b451c30ef0b3e83e7d124
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,3 +1,2 @@
1
1
  # encoding: utf-8
2
- require 'ostruct'
3
- require 'backports/2.0.0/stdlib/ostruct'
2
+ require 'ostruct'
@@ -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 == ''
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'json'
3
- require 'backports/rails/hash'
4
- require 'backports/2.0.0/struct'
3
+ require_relative 'hash'
5
4
 
6
5
  class Struct
7
6
  # def to_hash
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'backports'
4
3
  require 'libis/tools/config'
5
4
  require 'libis/tools/extend/string'
6
5
 
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Tools
3
- VERSION = '1.0.6'
3
+ VERSION = '1.0.7'
4
4
  end
5
5
  end
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.6
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-01-09 00:00:00.000000000 Z
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