utilise 1.1.0 → 1.2.0.pre.78
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +11 -7
- data/lib/utilise/augment/hash.rb +5 -5
- data/lib/utilise/version.rb +8 -5
- data/spec/utilise/version_spec.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7c1019e50124e3de68e5f1948fa204589890dd2162041f75f6b3a0e46c64ab53
|
4
|
+
data.tar.gz: 1875997c261894901a95ea80774a0bae55a2420cf4af88dda279e809c4477d37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d3f657b77ff76564382ee7313da03ce907d2313991fd48fe82dd0e147ffa3575417c70d5dc1afe153ce14a99e04e5e39b6aa1789147bd793af2ba6c686107b6
|
7
|
+
data.tar.gz: 9f34ab714fe3335665b9818db25b70df720bd9619103899fadc8c97625a858ec52071c768a9eeb56b5896b8bf6718abd77964bd4440d78609d634f332b98e460
|
data/README.md
CHANGED
@@ -32,6 +32,8 @@ gem install utilise
|
|
32
32
|
require 'utilise'
|
33
33
|
```
|
34
34
|
|
35
|
+
### to_bool
|
36
|
+
|
35
37
|
```ruby
|
36
38
|
1.to_bool
|
37
39
|
=> true
|
@@ -66,11 +68,15 @@ require 'utilise'
|
|
66
68
|
=> [false]
|
67
69
|
```
|
68
70
|
|
71
|
+
### Time#unique
|
72
|
+
|
69
73
|
```ruby
|
70
74
|
Time.unique
|
71
75
|
=> '80347765'
|
72
76
|
```
|
73
77
|
|
78
|
+
### bool?
|
79
|
+
|
74
80
|
```ruby
|
75
81
|
true.bool?
|
76
82
|
=> true
|
@@ -85,20 +91,18 @@ false.bool?
|
|
85
91
|
=> false
|
86
92
|
```
|
87
93
|
|
94
|
+
### string cases
|
95
|
+
|
88
96
|
```ruby
|
89
97
|
'snake_case'.camel
|
90
98
|
=> 'SnakeCase'
|
91
99
|
|
100
|
+
'snake_case'.camel(:lower)
|
101
|
+
=> 'snakeCase'
|
102
|
+
|
92
103
|
'space case'.snake
|
93
104
|
=> 'space_case'
|
94
105
|
|
95
106
|
'CamelCase'.space
|
96
107
|
=> 'camel case'
|
97
108
|
```
|
98
|
-
|
99
|
-
```ruby
|
100
|
-
hash = Hashie::Mash.new
|
101
|
-
=> {}
|
102
|
-
hash.key
|
103
|
-
=>
|
104
|
-
```
|
data/lib/utilise/augment/hash.rb
CHANGED
@@ -6,27 +6,27 @@ module Utilise
|
|
6
6
|
module Hash
|
7
7
|
# Transforms all keys to snake case
|
8
8
|
def snake_keys
|
9
|
-
utilise_deep_transform_keys(self
|
9
|
+
utilise_deep_transform_keys(self, &:snake)
|
10
10
|
end
|
11
11
|
|
12
12
|
# Transforms all keys to camel case
|
13
13
|
def camel_keys
|
14
|
-
utilise_deep_transform_keys(self
|
14
|
+
utilise_deep_transform_keys(self, &:camel)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Transforms all keys to space case
|
18
18
|
def space_keys
|
19
|
-
utilise_deep_transform_keys(self
|
19
|
+
utilise_deep_transform_keys(self, &:space)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Transforms all keys to a string
|
23
23
|
def string_keys
|
24
|
-
utilise_deep_transform_keys(self
|
24
|
+
utilise_deep_transform_keys(self, &:to_s)
|
25
25
|
end
|
26
26
|
|
27
27
|
# Transforms all keys to a symbol
|
28
28
|
def symbol_keys
|
29
|
-
utilise_deep_transform_keys(self
|
29
|
+
utilise_deep_transform_keys(self, &:to_sym)
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
data/lib/utilise/version.rb
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
# Utilise
|
2
2
|
module Utilise
|
3
3
|
# The current gem version
|
4
|
-
VERSION = '1.
|
4
|
+
VERSION = '1.2.0'.freeze
|
5
5
|
# The version update date
|
6
|
-
DATE = '
|
6
|
+
DATE = '2018-01-03'.freeze
|
7
7
|
# Debug output message
|
8
|
-
MSG = 'Version
|
8
|
+
MSG = 'Version %<version>s %<date>s (running on %<engine>s-%<ruby>s)'.freeze
|
9
9
|
|
10
10
|
module_function
|
11
11
|
|
12
12
|
# Outputs the current gem version
|
13
13
|
def version(debug = false)
|
14
14
|
if debug
|
15
|
-
format(MSG,
|
16
|
-
|
15
|
+
format(MSG,
|
16
|
+
version: VERSION,
|
17
|
+
date: DATE,
|
18
|
+
engine: RUBY_ENGINE,
|
19
|
+
ruby: RUBY_VERSION)
|
17
20
|
else
|
18
21
|
VERSION
|
19
22
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Utilise do
|
4
4
|
describe '.version' do
|
5
5
|
it 'should return the current gem version' do
|
6
|
-
expect(Utilise.version).to eq('1.
|
6
|
+
expect(Utilise.version).to eq('1.2.0')
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should return the current gem version with debug information' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utilise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.pre.78
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Slaughter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.49'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.49'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.9.11
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.9.11
|
111
111
|
description: Extends a few ruby classes with helpful methods
|
112
112
|
email: b.p.slaughter@gmail.com
|
113
113
|
executables: []
|
@@ -157,23 +157,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
|
-
- - "
|
160
|
+
- - ">"
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version:
|
162
|
+
version: 1.3.1
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.7.4
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Utilises a few extra methods
|
169
169
|
test_files:
|
170
170
|
- spec/spec_helper.rb
|
171
|
-
- spec/utilise/
|
171
|
+
- spec/utilise/time_spec.rb
|
172
|
+
- spec/utilise/object_spec.rb
|
172
173
|
- spec/utilise/hash_spec.rb
|
174
|
+
- spec/utilise/array_spec.rb
|
175
|
+
- spec/utilise/version_spec.rb
|
173
176
|
- spec/utilise/hashie_spec.rb
|
174
|
-
- spec/utilise/integer_spec.rb
|
175
|
-
- spec/utilise/object_spec.rb
|
176
177
|
- spec/utilise/string_spec.rb
|
177
178
|
- spec/utilise/symbol_spec.rb
|
178
|
-
- spec/utilise/
|
179
|
-
- spec/utilise/version_spec.rb
|
179
|
+
- spec/utilise/integer_spec.rb
|