everythingrb 0.8.2 → 0.8.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1dea4517af697abde3f07ffb40d62a7ec40b3f8c0b91cc74eb93edde92e5aac
4
- data.tar.gz: bb3888fac39b4d3138ddfb5f7d36504d3df28c274b4d9a950772aca0c5d5f0fc
3
+ metadata.gz: 6523ad82c57c693afadd2a17649c6628b49c0f775d0c3af09b5b207d8bace8a7
4
+ data.tar.gz: 8c0c363214cf537d6ada6ad78d0da899ddbfdc17066325774b9e8f6f97b9f6f1
5
5
  SHA512:
6
- metadata.gz: 341bf18d8e774f882b01b5ab50a7d262d113ecdbefab288c4e373cc6bb89b9f86a3ddf8a67d7a842016e6f62d04816db136c658106cf11685c50bd7d35693264
7
- data.tar.gz: d7d3f73c40cec2555958de71452af51945f681d7e9731edc477c6428e316e71c607e22d00abd9257a1b4dd6ee0be0ee33b067a745c996593109621251464c8ea
6
+ metadata.gz: 8a9f2620930ed9635287815679639cbd5403dc31b382717e107d8fbebf5fad0b6ba4be5398478f9b240141bbbbd2889cccbfc86d9330aeb1547386ab114bf034
7
+ data.tar.gz: 8b6f1facb28da84ad99d7e52d14196ae023521c8ea26c075e1649f02364a29595f424b8aa9719438742ae2f5cc8ce047336534e94357693c7a678f225fdbc353
data/CHANGELOG.md CHANGED
@@ -15,6 +15,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15
15
  ### Removed
16
16
  -->
17
17
 
18
+ ## [0.8.3] - 12025-05-31
19
+
20
+ ### Added
21
+
22
+ ### Changed
23
+
24
+ - **Deprecated Hash value filtering methods** - `Hash#select_values`, `Hash#reject_values`, `Hash#select_values!` and `Hash#reject_values!` are now deprecated and will be removed in v0.9.0. These methods largely duplicate existing Ruby/ActiveSupport functionality:
25
+ - `hash.reject_values(&:blank?)` → use `hash.compact_blank` instead
26
+ - `hash.select_values { |v| condition }` → use `hash.select { |k, v| condition }`
27
+ - `hash.reject_values { |v| condition }` → use `hash.reject { |k, v| condition }`
28
+
29
+ See [Issue #61](https://github.com/itsthedevman/everythingrb/issues/61) for full details.
30
+
31
+ ### Removed
32
+
18
33
  ## [0.8.2] - 12025-05-25
19
34
 
20
35
  ### Added
@@ -301,7 +316,8 @@ This change aligns our method signatures with Ruby's conventions and matches our
301
316
 
302
317
  - Added alias `each` to `each_pair` in OpenStruct for better enumerable compatibility
303
318
 
304
- [unreleased]: https://github.com/itsthedevman/everythingrb/compare/v0.8.2...HEAD
319
+ [unreleased]: https://github.com/itsthedevman/everythingrb/compare/v0.8.3...HEAD
320
+ [0.8.3]: https://github.com/itsthedevman/everythingrb/compare/v0.8.2...v0.8.3
305
321
  [0.8.2]: https://github.com/itsthedevman/everythingrb/compare/v0.8.1...v0.8.2
306
322
  [0.8.1]: https://github.com/itsthedevman/everythingrb/compare/v0.8.0...v0.8.1
307
323
  [0.8.0]: https://github.com/itsthedevman/everythingrb/compare/v0.7.0...v0.8.0
@@ -664,22 +664,13 @@ class Hash
664
664
  #
665
665
  # Selects hash entries based only on their values
666
666
  #
667
- # @yield [value] Block that determines whether to include the entry
668
- # @yieldparam value [Object] The current value
669
- # @yieldreturn [Boolean] Whether to include this entry
670
- #
671
- # @return [Hash] A new hash including only entries where the block returned truthy
672
- # @return [Enumerator] If no block is given
673
- #
674
- # @example Filter to include only present values (with ActiveSupport)
675
- # {name: "Alice", bio: nil, role: ""}.select_values(&:present?)
676
- # # => {name: "Alice"}
677
- #
678
- # @example Filter using more complex logic
679
- # {id: 1, count: 0, items: [1, 2, 3]}.select_values { |v| v.is_a?(Array) || v > 0 }
680
- # # => {id: 1, items: [1, 2, 3]}
667
+ # @deprecated Hash#select_values will be removed in 0.9.0. Please use `select { |k, v| condition }` instead.
681
668
  #
682
669
  def select_values(&block)
670
+ Everythingrb.deprecator.warn(
671
+ "Hash#select_values will be removed in 0.9.0. Please use `select { |k, v| condition }` instead."
672
+ )
673
+
683
674
  return to_enum(:select_values) if block.nil?
684
675
 
685
676
  select { |_k, v| block.call(v) }
@@ -690,20 +681,13 @@ class Hash
690
681
  #
691
682
  # Selects hash entries based only on their values, modifying the hash in place
692
683
  #
693
- # @yield [value] Block that determines whether to keep the entry
694
- # @yieldparam value [Object] The current value
695
- # @yieldreturn [Boolean] Whether to keep this entry
696
- #
697
- # @return [self, nil] The modified hash, or nil if no changes were made
698
- # @return [Enumerator] If no block is given
699
- #
700
- # @example Remove entries with empty values (with ActiveSupport)
701
- # hash = {name: "Alice", bio: nil, role: ""}
702
- # hash.select_values!(&:present?)
703
- # # => {name: "Alice"}
704
- # # hash is now {name: "Alice"}
684
+ # @deprecated Hash#select_values! will be removed in 0.9.0. Please use `select! { |k, v| condition }` instead.
705
685
  #
706
686
  def select_values!(&block)
687
+ Everythingrb.deprecator.warn(
688
+ "Hash#select_values! will be removed in 0.9.0. Please use `select! { |k, v| condition }` instead."
689
+ )
690
+
707
691
  return to_enum(:select_values!) if block.nil?
708
692
 
709
693
  select! { |_k, v| block.call(v) }
@@ -714,22 +698,13 @@ class Hash
714
698
  #
715
699
  # Rejects hash entries based only on their values
716
700
  #
717
- # @yield [value] Block that determines whether to exclude the entry
718
- # @yieldparam value [Object] The current value
719
- # @yieldreturn [Boolean] Whether to exclude this entry
720
- #
721
- # @return [Hash] A new hash excluding entries where the block returned truthy
722
- # @return [Enumerator] If no block is given
723
- #
724
- # @example Remove blank values (with ActiveSupport)
725
- # {name: "Alice", bio: nil, role: ""}.reject_values(&:blank?)
726
- # # => {name: "Alice"}
727
- #
728
- # @example Remove specific types of values
729
- # {id: 1, count: 0, items: [1, 2, 3]}.reject_values { |v| v.is_a?(Integer) && v == 0 }
730
- # # => {id: 1, items: [1, 2, 3]}
701
+ # @deprecated Hash#reject_values will be removed in 0.9.0. Please use `reject { |k, v| condition }` instead.
731
702
  #
732
703
  def reject_values(&block)
704
+ Everythingrb.deprecator.warn(
705
+ "Hash#reject_values will be removed in 0.9.0. Please use `reject { |k, v| condition }` instead."
706
+ )
707
+
733
708
  return to_enum(:reject_values) if block.nil?
734
709
 
735
710
  reject { |_k, v| block.call(v) }
@@ -738,20 +713,13 @@ class Hash
738
713
  #
739
714
  # Rejects hash entries based only on their values, modifying the hash in place
740
715
  #
741
- # @yield [value] Block that determines whether to remove the entry
742
- # @yieldparam value [Object] The current value
743
- # @yieldreturn [Boolean] Whether to remove this entry
744
- #
745
- # @return [self, nil] The modified hash, or nil if no changes were made
746
- # @return [Enumerator] If no block is given
747
- #
748
- # @example Remove blank values in place (with ActiveSupport)
749
- # hash = {name: "Alice", bio: nil, role: ""}
750
- # hash.reject_values!(&:blank?)
751
- # # => {name: "Alice"}
752
- # # hash is now {name: "Alice"}
716
+ # @deprecated Hash#reject_values! will be removed in 0.9.0. Please use `reject! { |k, v| condition }` instead.
753
717
  #
754
718
  def reject_values!(&block)
719
+ Everythingrb.deprecator.warn(
720
+ "Hash#reject_values! will be removed in 0.9.0. Please use `reject! { |k, v| condition }` instead."
721
+ )
722
+
755
723
  return to_enum(:reject_values!) if block.nil?
756
724
 
757
725
  reject! { |_k, v| block.call(v) }
@@ -25,6 +25,15 @@ require "json"
25
25
  # users.key_map(:name).join(", ") # => "Alice, Bob"
26
26
  #
27
27
  module Everythingrb
28
+ def self.deprecator
29
+ @deprecator ||= if defined?(ActiveSupport)
30
+ ActiveSupport::Deprecation.new(VERSION, "everythingrb")
31
+ else
32
+ proxy = Data.define
33
+ proxy.define_method(:warn) { |message| puts "DEPRECATION WARNING: #{message}" }
34
+ proxy.new
35
+ end
36
+ end
28
37
  end
29
38
 
30
39
  require_relative "extensions"
@@ -7,5 +7,5 @@
7
7
  #
8
8
  module Everythingrb
9
9
  # Current version of the everythingrb gem
10
- VERSION = "0.8.2"
10
+ VERSION = "0.8.3"
11
11
  end
data/lib/everythingrb.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "everythingrb/prelude"
4
-
5
3
  if defined?(Rails::Railtie)
6
4
  require_relative "railtie"
7
5
  else
6
+ require_relative "everythingrb/prelude"
8
7
  require_relative "everythingrb/all"
9
8
  end
data/lib/railtie.rb CHANGED
@@ -24,6 +24,8 @@ module Everythingrb
24
24
  # I learned that, whereas ActiveSupport is defined at this point, the core_ext files are
25
25
  # required later down the line.
26
26
  ActiveSupport.on_load(:active_record) do
27
+ require_relative "everythingrb/prelude"
28
+
27
29
  extensions = Rails.configuration.everythingrb.extensions
28
30
 
29
31
  if extensions.is_a?(Array)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everythingrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-26 00:00:00.000000000 Z
11
+ date: 2025-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ostruct