ruby_smart-support 1.3.0 → 1.4.0

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: 4e2254a95ec35c6fcbd887b968dbc6a75bdfdc68289450f19b79b302cd9010d9
4
- data.tar.gz: ade5163e4e702f1a9526da9619d40db03b60ba16505ec1e5c5408ce67642d00d
3
+ metadata.gz: 1775b5245ce4c9ca6de799fc00e1144c3b9025f75c1dc2ddbeea2aefc45e7d66
4
+ data.tar.gz: 72749e09f012e15c978a50e03ecc2dc3c7a20bdefeda9b461b127174702e8802
5
5
  SHA512:
6
- metadata.gz: e828e44eca0c4d4c7723a03f1364463d2c6d9d7190218a089ea401c8c40d3762ef491d5df0d8d9d7086144407db7253058e7beb424771369e4ac5f1b37209fa8
7
- data.tar.gz: c44c1784d5219dc885ab96c5dace9f877e8ded2f7c1d6ae4a2aab111a480de21ebaf03d4ae0ca63cd8f81e7625c5e3f386d1f02e55a6873b103b33ff001c0316
6
+ metadata.gz: d5073cc0aac8b4a59b79fc3809b2319bac5dd9cba53b2bd0c73110f40ef6aaa280a352b9b393c29c7a6745a4960b58536cdb54a743f5c2029734454048b4e1d2
7
+ data.tar.gz: bcc21095d341d019e833fe3bfb0fd39ed2bb0acaf18ac50a6a60a568a573349f465ab106dfe552e8f61e83685096b82fefd254bb4609ca0ad263a02e7ede6af2
@@ -18,21 +18,17 @@ permissions:
18
18
 
19
19
  jobs:
20
20
  test:
21
-
22
- runs-on: ubuntu-latest
23
21
  strategy:
22
+ fail-fast: false
24
23
  matrix:
25
- ruby-version: ['3.1', '3.0', '2.7', '2.6']
26
-
24
+ os: [ubuntu-latest]
25
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
26
+ ruby: ['3.2', '3.1', '3.0', '2.7', '2.6']
27
+ runs-on: ${{ matrix.os }}
27
28
  steps:
28
- - uses: actions/checkout@v3
29
- - name: Set up Ruby
30
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
- # uses: ruby/setup-ruby@v1
33
- uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3
34
- with:
35
- ruby-version: ${{ matrix.ruby-version }}
36
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
- - name: Run tests
38
- run: bundle exec rake
29
+ - uses: actions/checkout@v3
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - run: bundle exec rake
data/README.md CHANGED
@@ -40,6 +40,7 @@ Or install it yourself as:
40
40
  * *Hash* `#to_md5`, `#product`
41
41
  * *Object* `#numeric?`, `#boolean?`, `#missing_method?`, `#alias_missing_method`
42
42
  * *String* `#to_boolean`, `#to_md5`
43
+ * *Enumerator* `#from_hash`
43
44
 
44
45
  * extensions for activesupport
45
46
  * *Hash* `#only!`, `#without!`, `#deep_reject`
@@ -85,6 +86,7 @@ ThreadInfo.info
85
86
  * .console?
86
87
  * .irb?
87
88
  * .pry?
89
+ * .sidekiq?
88
90
  * .server?
89
91
  * .rails_console?
90
92
  * .io_console?
@@ -119,6 +121,11 @@ GemInfo.installed
119
121
  GemInfo.loaded
120
122
  # > {'bundler' => '2.2.30', ...}
121
123
 
124
+ # returns a hash of all loaded gems with its current license
125
+ # (gems from the Gemfile)
126
+ GemInfo.licenses
127
+ # > {'bundler' => 'MIT', ...}
128
+
122
129
  # returns an array of all active gems
123
130
  GemInfo.active
124
131
  # > ['bundler', ...]
@@ -155,6 +162,7 @@ GemInfo.match?( '0.1.0', '~> 1.1.0',)
155
162
  * .installed?
156
163
  * .loaded
157
164
  * .loaded?
165
+ * .licenses
158
166
  * .active
159
167
  * .active?
160
168
  * .features
@@ -195,6 +203,21 @@ rake db:migrate
195
203
  # > executes append block
196
204
  ```
197
205
 
206
+
207
+ ## Enumerator extensions
208
+
209
+ With the new method `from_hash` you can now easily map values from an array of hashes.
210
+
211
+ ```ruby
212
+ ary = [{a: 34, b: 12}, {a: 19, c: 4}, {b: 3, c: 11}]
213
+ ary.map.from_hash(:a)
214
+ # > [34, 19, nil]
215
+
216
+ ```
217
+
218
+
219
+
220
+
198
221
  -----
199
222
 
200
223
  ## Docs
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # RubySmart::Support - CHANGELOG
2
2
 
3
+ ## [1.4.0] - 2023-10-19
4
+ * **[ref]** `RubySmart::Support::ThreadInfo.sidekiq?`-detection to determinate if the current thread is a sidekiq process
5
+
3
6
  ## [1.3.0] - 2023-08-08
4
7
  * **[add]** `Enumerator.from_hash` to easily resolve values from Array-of-Hashes (use: ary.map.from_hash(key))
5
8
  * **[add]** `RubySmart::Support::GemInfo.licenses` to resolve a hash of licences per loaded gem
@@ -7,7 +7,7 @@ unless Enumerator.method_defined? :from_hash
7
7
  #
8
8
  # @example
9
9
  # ary = [{a: 34, b: 12}, {a: 19, c: 4}, {b: 3, c: 11}]
10
- # ary.with_hash(:a)
10
+ # ary.map.from_hash(:a)
11
11
  # > [34, 19, nil]
12
12
  #
13
13
  # @param [Object] key
@@ -9,7 +9,7 @@ module RubySmart
9
9
 
10
10
  module VERSION
11
11
  MAJOR = 1
12
- MINOR = 3
12
+ MINOR = 4
13
13
  TINY = 0
14
14
  PRE = nil
15
15
 
@@ -7,7 +7,7 @@ module RubySmart
7
7
  module ThreadInfo
8
8
 
9
9
  # defines a array of types which will be checked by resolving the current thread type
10
- TYPE_ORDER = [:rake, :console, :server].freeze
10
+ TYPE_ORDER = [:rake, :console, :sidekiq, :server].freeze
11
11
 
12
12
  # returns true if this is a running rake process
13
13
  # @return [Boolean]
@@ -39,6 +39,12 @@ module RubySmart
39
39
  !!defined?(Pry)
40
40
  end
41
41
 
42
+ # returns true if this is a running 'sidekiq' server process.
43
+ # @return [Boolean]
44
+ def self.sidekiq?
45
+ !!defined?(Sidekiq) && Sidekiq.server?
46
+ end
47
+
42
48
  # returns true if this is a running server process.
43
49
  # currently only detects rails
44
50
  # @return [Boolean]
@@ -36,4 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency 'rake', '~> 13.0'
37
37
  spec.add_development_dependency 'rspec', '~> 3.0'
38
38
  spec.add_development_dependency 'yard', '~> 0.9'
39
+ spec.add_development_dependency 'yard-activesupport-concern', '~> 0.0.1'
40
+ spec.add_development_dependency 'yard-relative_markdown_links', '>= 0.4'
39
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_smart-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gonsior
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-08 00:00:00.000000000 Z
11
+ date: 2023-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard-activesupport-concern
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.0.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.0.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard-relative_markdown_links
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0.4'
83
111
  description: 'RubySmart::Support is a toolkit of support libraries for Ruby - major
84
112
  features includes GemInfo & ThreadInfo, as well core extensions for Ruby & activesupport
85
113
  (if installed).
@@ -131,7 +159,7 @@ metadata:
131
159
  documentation_uri: https://rubydoc.info/gems/ruby_smart-support
132
160
  changelog_uri: https://github.com/ruby-smart/support/blob/main/docs/CHANGELOG.md
133
161
  allowed_push_host: https://rubygems.org
134
- post_install_message:
162
+ post_install_message:
135
163
  rdoc_options: []
136
164
  require_paths:
137
165
  - lib
@@ -146,8 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
174
  - !ruby/object:Gem::Version
147
175
  version: '0'
148
176
  requirements: []
149
- rubygems_version: 3.3.7
150
- signing_key:
177
+ rubygems_version: 3.4.10
178
+ signing_key:
151
179
  specification_version: 4
152
180
  summary: A toolkit of support libraries including GemInfo, ThreadInfo, Ruby core extensions
153
181
  & optionally activesupport extensions