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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/ruby-rails-extensions/extensions/all_keys.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/all_values.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/any_key.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/any_value.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/assign_nil.rb +51 -56
- data/lib/ruby-rails-extensions/extensions/clean_string.rb +22 -30
- data/lib/ruby-rails-extensions/extensions/compact_blank_join.rb +6 -8
- data/lib/ruby-rails-extensions/extensions/compact_map.rb +11 -15
- data/lib/ruby-rails-extensions/extensions/current_day.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/current_month.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/current_week.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/day_of_week.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/display_military.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/display_user.rb +9 -15
- data/lib/ruby-rails-extensions/extensions/find_bang.rb +7 -11
- data/lib/ruby-rails-extensions/extensions/find_dupes.rb +8 -10
- data/lib/ruby-rails-extensions/extensions/first_dupe.rb +4 -6
- data/lib/ruby-rails-extensions/extensions/google_format.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/hash_only.rb +16 -20
- data/lib/ruby-rails-extensions/extensions/humanize_symbol.rb +2 -4
- data/lib/ruby-rails-extensions/extensions/in_utc.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/input.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/month_and_year.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/month_year.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/no_keys.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/no_values.rb +3 -5
- data/lib/ruby-rails-extensions/extensions/only_some.rb +16 -18
- data/lib/ruby-rails-extensions/extensions/overlaps.rb +5 -9
- data/lib/ruby-rails-extensions/extensions/pipe.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/presence_bang.rb +9 -11
- data/lib/ruby-rails-extensions/extensions/quarter_dates.rb +28 -34
- data/lib/ruby-rails-extensions/extensions/range_add.rb +36 -38
- data/lib/ruby-rails-extensions/extensions/range_multiply.rb +36 -38
- data/lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb +18 -20
- data/lib/ruby-rails-extensions/extensions/safe_parse.rb +15 -21
- data/lib/ruby-rails-extensions/extensions/select_present.rb +2 -6
- data/lib/ruby-rails-extensions/extensions/select_present_join.rb +1 -3
- data/lib/ruby-rails-extensions/extensions/set_to_sentence.rb +2 -4
- data/lib/ruby-rails-extensions/extensions/to_bool.rb +14 -24
- data/lib/ruby-rails-extensions/extensions/to_dec.rb +9 -15
- data/lib/ruby-rails-extensions/extensions/to_i.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/to_local.rb +8 -12
- data/lib/ruby-rails-extensions/extensions/to_negative_i.rb +22 -28
- data/lib/ruby-rails-extensions/extensions/to_nonzero_i.rb +22 -28
- data/lib/ruby-rails-extensions/extensions/to_or_sentence.rb +5 -9
- data/lib/ruby-rails-extensions/extensions/to_positive_i.rb +22 -28
- data/lib/ruby-rails-extensions/extensions/to_sort_i.rb +5 -11
- data/lib/ruby-rails-extensions/extensions/to_x.rb +9 -15
- data/lib/ruby-rails-extensions/extensions/todays_date.rb +9 -12
- data/lib/ruby-rails-extensions/extensions/uniq_map.rb +13 -15
- data/lib/ruby-rails-extensions/extensions/usd_to_f.rb +9 -15
- data/lib/ruby-rails-extensions/extensions/usd_to_i.rb +6 -10
- data/lib/ruby-rails-extensions/extensions/weighted_sum.rb +16 -18
- data/lib/ruby-rails-extensions/extensions/yesno.rb +9 -15
- data/lib/ruby-rails-extensions/extensions/zero_range.rb +14 -16
- data/lib/ruby-rails-extensions/version.rb +1 -1
- metadata +2 -2
@@ -1,22 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Range.class_eval do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
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:
|
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-
|
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
|