ruby-rails-extensions 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/lib/ruby-rails-extensions/extensions/all_keys.rb +3 -5
  4. data/lib/ruby-rails-extensions/extensions/all_values.rb +3 -5
  5. data/lib/ruby-rails-extensions/extensions/any_key.rb +3 -5
  6. data/lib/ruby-rails-extensions/extensions/any_value.rb +3 -5
  7. data/lib/ruby-rails-extensions/extensions/assign_nil.rb +51 -56
  8. data/lib/ruby-rails-extensions/extensions/clean_string.rb +22 -30
  9. data/lib/ruby-rails-extensions/extensions/compact_blank_join.rb +6 -8
  10. data/lib/ruby-rails-extensions/extensions/compact_map.rb +11 -15
  11. data/lib/ruby-rails-extensions/extensions/current_day.rb +3 -5
  12. data/lib/ruby-rails-extensions/extensions/current_month.rb +6 -10
  13. data/lib/ruby-rails-extensions/extensions/current_week.rb +6 -10
  14. data/lib/ruby-rails-extensions/extensions/day_of_week.rb +6 -10
  15. data/lib/ruby-rails-extensions/extensions/display_military.rb +6 -10
  16. data/lib/ruby-rails-extensions/extensions/display_user.rb +9 -15
  17. data/lib/ruby-rails-extensions/extensions/find_bang.rb +7 -11
  18. data/lib/ruby-rails-extensions/extensions/find_dupes.rb +8 -10
  19. data/lib/ruby-rails-extensions/extensions/first_dupe.rb +4 -6
  20. data/lib/ruby-rails-extensions/extensions/google_format.rb +3 -5
  21. data/lib/ruby-rails-extensions/extensions/hash_only.rb +16 -20
  22. data/lib/ruby-rails-extensions/extensions/humanize_symbol.rb +2 -4
  23. data/lib/ruby-rails-extensions/extensions/in_utc.rb +6 -10
  24. data/lib/ruby-rails-extensions/extensions/input.rb +6 -10
  25. data/lib/ruby-rails-extensions/extensions/month_and_year.rb +3 -5
  26. data/lib/ruby-rails-extensions/extensions/month_year.rb +3 -5
  27. data/lib/ruby-rails-extensions/extensions/no_keys.rb +3 -5
  28. data/lib/ruby-rails-extensions/extensions/no_values.rb +3 -5
  29. data/lib/ruby-rails-extensions/extensions/only_some.rb +16 -18
  30. data/lib/ruby-rails-extensions/extensions/overlaps.rb +5 -9
  31. data/lib/ruby-rails-extensions/extensions/pipe.rb +6 -10
  32. data/lib/ruby-rails-extensions/extensions/presence_bang.rb +9 -11
  33. data/lib/ruby-rails-extensions/extensions/quarter_dates.rb +28 -34
  34. data/lib/ruby-rails-extensions/extensions/range_add.rb +36 -38
  35. data/lib/ruby-rails-extensions/extensions/range_multiply.rb +36 -38
  36. data/lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb +18 -20
  37. data/lib/ruby-rails-extensions/extensions/safe_parse.rb +15 -21
  38. data/lib/ruby-rails-extensions/extensions/select_present.rb +2 -6
  39. data/lib/ruby-rails-extensions/extensions/select_present_join.rb +1 -3
  40. data/lib/ruby-rails-extensions/extensions/set_to_sentence.rb +2 -4
  41. data/lib/ruby-rails-extensions/extensions/to_bool.rb +14 -24
  42. data/lib/ruby-rails-extensions/extensions/to_dec.rb +9 -15
  43. data/lib/ruby-rails-extensions/extensions/to_i.rb +6 -10
  44. data/lib/ruby-rails-extensions/extensions/to_local.rb +8 -12
  45. data/lib/ruby-rails-extensions/extensions/to_negative_i.rb +22 -28
  46. data/lib/ruby-rails-extensions/extensions/to_nonzero_i.rb +22 -28
  47. data/lib/ruby-rails-extensions/extensions/to_or_sentence.rb +5 -9
  48. data/lib/ruby-rails-extensions/extensions/to_positive_i.rb +22 -28
  49. data/lib/ruby-rails-extensions/extensions/to_sort_i.rb +5 -11
  50. data/lib/ruby-rails-extensions/extensions/to_x.rb +9 -15
  51. data/lib/ruby-rails-extensions/extensions/todays_date.rb +9 -12
  52. data/lib/ruby-rails-extensions/extensions/uniq_map.rb +13 -15
  53. data/lib/ruby-rails-extensions/extensions/usd_to_f.rb +9 -15
  54. data/lib/ruby-rails-extensions/extensions/usd_to_i.rb +6 -10
  55. data/lib/ruby-rails-extensions/extensions/weighted_sum.rb +16 -18
  56. data/lib/ruby-rails-extensions/extensions/yesno.rb +9 -15
  57. data/lib/ruby-rails-extensions/extensions/zero_range.rb +14 -16
  58. data/lib/ruby-rails-extensions/version.rb +1 -1
  59. metadata +2 -2
@@ -1,22 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Range.class_eval do
4
- unless method_defined?(:zero?)
5
- # Checks if the whole range is zero.
6
- #
7
- # @raise [RubyRailsExtensions::Errors::NonNumericError]
8
- #
9
- # @return [Boolean]
10
- #
11
- def zero?
12
- unless self.begin.is_a?(Numeric)
13
- raise(
14
- RubyRailsExtensions::Errors::NonNumericError,
15
- "Wrong range type (given #{self.begin.class}, expected Numeric)"
16
- )
17
- end
18
-
19
- self.begin.zero? && self.end.zero?
4
+ # Checks if the whole range is zero.
5
+ #
6
+ # @raise [RubyRailsExtensions::Errors::NonNumericError]
7
+ #
8
+ # @return [Boolean]
9
+ #
10
+ def zero?
11
+ unless self.begin.is_a?(Numeric)
12
+ raise(
13
+ RubyRailsExtensions::Errors::NonNumericError,
14
+ "Wrong range type (given #{self.begin.class}, expected Numeric)"
15
+ )
20
16
  end
17
+
18
+ self.begin.zero? && self.end.zero?
21
19
  end
22
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyRailsExtensions
4
- VERSION = '1.1.1'
4
+ VERSION = '2.0.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-rails-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-01 00:00:00.000000000 Z
11
+ date: 2024-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop-rubomatic-rails