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
@@ -3,19 +3,15 @@
3
3
  require 'date'
4
4
 
5
5
  DateTime.class_eval do
6
- unless method_defined?(:in_utc)
7
- # @return [DateTime]
8
- def in_utc
9
- utc? ? self : in_time_zone('UTC').to_datetime
10
- end
6
+ # @return [DateTime]
7
+ def in_utc
8
+ utc? ? self : in_time_zone('UTC').to_datetime
11
9
  end
12
10
  end
13
11
 
14
12
  Time.class_eval do
15
- unless method_defined?(:in_utc)
16
- # @return [Time]
17
- def in_utc
18
- utc? ? self : in_time_zone('UTC')
19
- end
13
+ # @return [Time]
14
+ def in_utc
15
+ utc? ? self : in_time_zone('UTC')
20
16
  end
21
17
  end
@@ -3,19 +3,15 @@
3
3
  require 'date'
4
4
 
5
5
  DateTime.class_eval do
6
- unless method_defined?(:input)
7
- # @return [String] - yyyy-mm-dd[Thh:mm::ss]
8
- def input(all = false)
9
- strftime(all ? '%F %T' : '%F')
10
- end
6
+ # @return [String] - yyyy-mm-dd[Thh:mm::ss]
7
+ def input(all = false)
8
+ strftime(all ? '%F %T' : '%F')
11
9
  end
12
10
  end
13
11
 
14
12
  Date.class_eval do
15
- unless method_defined?(:input)
16
- # @return [String] - yyyy-mm-dd
17
- def input(_all = false)
18
- strftime('%F')
19
- end
13
+ # @return [String] - yyyy-mm-dd
14
+ def input(_all = false)
15
+ strftime('%F')
20
16
  end
21
17
  end
@@ -3,10 +3,8 @@
3
3
  require 'date'
4
4
 
5
5
  Date.class_eval do
6
- unless method_defined?(:month_and_year)
7
- # @return [String] - mm/yy
8
- def month_and_year
9
- strftime('%m/%y')
10
- end
6
+ # @return [String] - mm/yy
7
+ def month_and_year
8
+ strftime('%m/%y')
11
9
  end
12
10
  end
@@ -3,10 +3,8 @@
3
3
  require 'date'
4
4
 
5
5
  Date.class_eval do
6
- unless method_defined?(:month_year)
7
- # @return [String] - yyyy-mm
8
- def month_year
9
- input[0, 7]
10
- end
6
+ # @return [String] - yyyy-mm
7
+ def month_year
8
+ input[0, 7]
11
9
  end
12
10
  end
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Hash.class_eval do
4
- unless method_defined?(:no_keys?)
5
- # @see Enumerable#none?
6
- def no_keys?(...)
7
- keys.none?(...)
8
- end
4
+ # @see Enumerable#none?
5
+ def no_keys?(...)
6
+ keys.none?(...)
9
7
  end
10
8
  end
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Hash.class_eval do
4
- unless method_defined?(:no_values?)
5
- # @see Enumerable#none?
6
- def no_values?(...)
7
- values.none?(...)
8
- end
4
+ # @see Enumerable#none?
5
+ def no_values?(...)
6
+ values.none?(...)
9
7
  end
10
8
  end
@@ -1,28 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Array.class_eval do
4
- unless method_defined?(:only_some?)
5
- # Same as `my_array.any?(&block) && !my_array.all?(&block)`
6
- #
7
- # @return [Boolean]
8
- #
9
- def only_some?(*meth_args)
10
- # Check arg size since `any?` arg take presence over block
11
- return any?(*meth_args) && !all?(*meth_args) if meth_args.size.positive?
4
+ # Same as `my_array.any?(&block) && !my_array.all?(&block)`
5
+ #
6
+ # @return [Boolean]
7
+ #
8
+ def only_some?(*meth_args)
9
+ # Check arg size since `any?` arg take presence over block
10
+ return any?(*meth_args) && !all?(*meth_args) if meth_args.size.positive?
12
11
 
13
- any = false
14
- all = true
12
+ any = false
13
+ all = true
15
14
 
16
- each do |*args|
17
- result = yield(*args)
15
+ each do |*args|
16
+ result = yield(*args)
18
17
 
19
- any ||= result
20
- all &&= result
18
+ any ||= result
19
+ all &&= result
21
20
 
22
- break if any && !all
23
- end
24
-
25
- return any && !all
21
+ break if any && !all
26
22
  end
23
+
24
+ return any && !all
27
25
  end
28
26
  end
@@ -4,18 +4,14 @@ require 'forwardable'
4
4
  require 'set'
5
5
 
6
6
  Array.class_eval do
7
- unless method_defined?(:overlaps?)
8
- # @return [Boolean]
9
- def overlaps?(other)
10
- !(self & Array(other)).empty?
11
- end
7
+ # @return [Boolean]
8
+ def overlaps?(other)
9
+ !(self & Array(other)).empty?
12
10
  end
13
11
  end
14
12
 
15
13
  Set.class_eval do
16
- unless method_defined?(:overlaps?)
17
- extend Forwardable
14
+ extend Forwardable
18
15
 
19
- def_delegators :to_a, :overlaps?
20
- end
16
+ def_delegators :to_a, :overlaps?
21
17
  end
@@ -4,19 +4,15 @@ require 'forwardable'
4
4
  require 'set'
5
5
 
6
6
  Array.class_eval do
7
- unless method_defined?(:pipe)
8
- # Replace my_array.map(&:method1).map(&:method2) with my_array.pipe(:method1, :method2)
9
- # @return [Array]
10
- def pipe(*fns)
11
- map { |a| fns.reduce(a, &:send) }
12
- end
7
+ # Replace my_array.map(&:method1).map(&:method2) with my_array.pipe(:method1, :method2)
8
+ # @return [Array]
9
+ def pipe(*fns)
10
+ map { |a| fns.reduce(a, &:send) }
13
11
  end
14
12
  end
15
13
 
16
14
  Set.class_eval do
17
- unless method_defined?(:pipe)
18
- extend Forwardable
15
+ extend Forwardable
19
16
 
20
- def_delegators :to_a, :pipe
21
- end
17
+ def_delegators :to_a, :pipe
22
18
  end
@@ -1,17 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Object.class_eval do
4
- unless method_defined?(:presence!)
5
- # Returns self if `present?`
6
- #
7
- # @raise [BlankObject] if `blank?`
8
- #
9
- # @return [*]
10
- #
11
- def presence!
12
- raise(RubyRailsExtensions::Errors::BlankObjectError, 'Blank object') if blank?
4
+ # Returns self if `present?`
5
+ #
6
+ # @raise [BlankObject] if `blank?`
7
+ #
8
+ # @return [*]
9
+ #
10
+ def presence!
11
+ raise(RubyRailsExtensions::Errors::BlankObjectError, 'Blank object') if blank?
13
12
 
14
- self
15
- end
13
+ self
16
14
  end
17
15
  end
@@ -1,47 +1,41 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  String.class_eval do
4
- if !method_defined?(:quarter_start) && Date.instance_methods.include?(:beginning_of_quarter)
5
- # Return the quarter start date.
6
- #
7
- # @return [Date]
8
- #
9
- def quarter_start
10
- quarter_date.beginning_of_quarter
11
- end
4
+ # Return the quarter start date.
5
+ #
6
+ # @return [Date]
7
+ #
8
+ def quarter_start
9
+ quarter_date.beginning_of_quarter
12
10
  end
13
11
 
14
- if !method_defined?(:quarter_end) && Date.instance_methods.include?(:end_of_quarter)
15
- # Return the quarter end date.
16
- #
17
- # @return [Date]
18
- #
19
- def quarter_end
20
- quarter_date.end_of_quarter
21
- end
12
+ # Return the quarter end date.
13
+ #
14
+ # @return [Date]
15
+ #
16
+ def quarter_end
17
+ quarter_date.end_of_quarter
22
18
  end
23
19
 
24
20
  private
25
21
 
26
- unless private_method_defined?(:quarter_date)
27
- # Parses a string for a quarter date. Expects the string to follow: 'qQyy' where
28
- # q = 1/2/3/4 and yy to be the last two digits of the year.
29
- #
30
- # @raise [RubyRailsExtensions::Errors::InvalidFormatError] if `self` is not qQyy
31
- #
32
- # @return [Date]
33
- #
34
- def quarter_date
35
- unless match?(/\A[1-4]q\d\d\z/i)
36
- raise(RubyRailsExtensions::Errors::InvalidFormatError, "Unexpected format (given #{self}, expected qQyy)")
37
- end
22
+ # Parses a string for a quarter date. Expects the string to follow: 'qQyy' where
23
+ # q = 1/2/3/4 and yy to be the last two digits of the year.
24
+ #
25
+ # @raise [RubyRailsExtensions::Errors::InvalidFormatError] if `self` is not qQyy
26
+ #
27
+ # @return [Date]
28
+ #
29
+ def quarter_date
30
+ unless match?(/\A[1-4]q\d\d\z/i)
31
+ raise(RubyRailsExtensions::Errors::InvalidFormatError, "Unexpected format (given #{self}, expected qQyy)")
32
+ end
38
33
 
39
- values = scan(/\d/)
40
- quarter = values.shift.to_i
41
- year = "20#{values.join('')}".to_i
42
- month = quarter * 3
34
+ values = scan(/\d/)
35
+ quarter = values.shift.to_i
36
+ year = "20#{values.join('')}".to_i
37
+ month = quarter * 3
43
38
 
44
- Date.new(year, month, 1)
45
- end
39
+ Date.new(year, month, 1)
46
40
  end
47
41
  end
@@ -1,47 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Range.class_eval do
4
- unless method_defined?(:+)
5
- # Allows adding a to a range. This will create a new range since ranges are immutable.
6
- #
7
- # @note Make sure to assign this to a new var or inline replacement `+=`.
8
- #
9
- # @raise [RubyRailsExtensions::Errors::NonNumericError]
10
- #
11
- # @param other [Numeric, Range<Numeric>]
12
- #
13
- # @return [Range]
14
- #
15
- def +(other)
16
- unless self.begin.is_a?(Numeric)
17
- raise(
18
- RubyRailsExtensions::Errors::NonNumericError,
19
- "Wrong range type (given #{self.begin.class}, expected Numeric)"
20
- )
21
- end
22
-
23
- new_begin, new_end =
24
- if other.is_a?(Range)
25
- unless other.begin.is_a?(Numeric)
26
- raise(
27
- RubyRailsExtensions::Errors::NonNumericError,
28
- "Wrong range type (given #{other.begin.class}, expected Numeric)"
29
- )
30
- end
4
+ # Allows adding a to a range. This will create a new range since ranges are immutable.
5
+ #
6
+ # @note Make sure to assign this to a new var or inline replacement `+=`.
7
+ #
8
+ # @raise [RubyRailsExtensions::Errors::NonNumericError]
9
+ #
10
+ # @param other [Numeric, Range<Numeric>]
11
+ #
12
+ # @return [Range]
13
+ #
14
+ def +(other)
15
+ unless self.begin.is_a?(Numeric)
16
+ raise(
17
+ RubyRailsExtensions::Errors::NonNumericError,
18
+ "Wrong range type (given #{self.begin.class}, expected Numeric)"
19
+ )
20
+ end
31
21
 
32
- [self.begin + other.begin, self.end + other.end]
33
- else
34
- unless other.is_a?(Numeric)
35
- raise(
36
- RubyRailsExtensions::Errors::NonNumericError,
37
- "Wrong type (given #{other.class}, expected Numeric)"
38
- )
39
- end
22
+ new_begin, new_end =
23
+ if other.is_a?(Range)
24
+ unless other.begin.is_a?(Numeric)
25
+ raise(
26
+ RubyRailsExtensions::Errors::NonNumericError,
27
+ "Wrong range type (given #{other.begin.class}, expected Numeric)"
28
+ )
29
+ end
40
30
 
41
- [self.begin + other, self.end + other]
31
+ [self.begin + other.begin, self.end + other.end]
32
+ else
33
+ unless other.is_a?(Numeric)
34
+ raise(
35
+ RubyRailsExtensions::Errors::NonNumericError,
36
+ "Wrong type (given #{other.class}, expected Numeric)"
37
+ )
42
38
  end
43
39
 
44
- Range.new(new_begin, new_end, exclude_end?)
45
- end
40
+ [self.begin + other, self.end + other]
41
+ end
42
+
43
+ Range.new(new_begin, new_end, exclude_end?)
46
44
  end
47
45
  end
@@ -1,47 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Range.class_eval do
4
- unless method_defined?(:*)
5
- # Allows multiplying a range. This will create a new range due to range objects being immutable.
6
- #
7
- # @note Make sure to assign this to a new var or do inline replacement `*=`.
8
- #
9
- # @raise [RubyRailsExtensions::Errors::NonNumericError]
10
- #
11
- # @param other [Numeric, Range<Numeric>]
12
- #
13
- # @return [Range]
14
- #
15
- def *(other)
16
- unless self.begin.is_a?(Numeric)
17
- raise(
18
- RubyRailsExtensions::Errors::NonNumericError,
19
- "Wrong range type (given #{self.begin.class}, expected Numeric)"
20
- )
21
- end
22
-
23
- new_begin, new_end =
24
- if other.is_a?(Range)
25
- unless other.begin.is_a?(Numeric)
26
- raise(
27
- RubyRailsExtensions::Errors::NonNumericError,
28
- "Wrong range type (given #{other.begin.class}, expected Numeric)"
29
- )
30
- end
4
+ # Allows multiplying a range. This will create a new range due to range objects being immutable.
5
+ #
6
+ # @note Make sure to assign this to a new var or do inline replacement `*=`.
7
+ #
8
+ # @raise [RubyRailsExtensions::Errors::NonNumericError]
9
+ #
10
+ # @param other [Numeric, Range<Numeric>]
11
+ #
12
+ # @return [Range]
13
+ #
14
+ def *(other)
15
+ unless self.begin.is_a?(Numeric)
16
+ raise(
17
+ RubyRailsExtensions::Errors::NonNumericError,
18
+ "Wrong range type (given #{self.begin.class}, expected Numeric)"
19
+ )
20
+ end
31
21
 
32
- [self.begin * other.begin, self.end * other.end]
33
- else
34
- unless other.is_a?(Numeric)
35
- raise(
36
- RubyRailsExtensions::Errors::NonNumericError,
37
- "Wrong type (given #{other.class}, expected Numeric)"
38
- )
39
- end
22
+ new_begin, new_end =
23
+ if other.is_a?(Range)
24
+ unless other.begin.is_a?(Numeric)
25
+ raise(
26
+ RubyRailsExtensions::Errors::NonNumericError,
27
+ "Wrong range type (given #{other.begin.class}, expected Numeric)"
28
+ )
29
+ end
40
30
 
41
- [self.begin * other, self.end * other]
31
+ [self.begin * other.begin, self.end * other.end]
32
+ else
33
+ unless other.is_a?(Numeric)
34
+ raise(
35
+ RubyRailsExtensions::Errors::NonNumericError,
36
+ "Wrong type (given #{other.class}, expected Numeric)"
37
+ )
42
38
  end
43
39
 
44
- Range.new(new_begin, new_end, exclude_end?)
45
- end
40
+ [self.begin * other, self.end * other]
41
+ end
42
+
43
+ Range.new(new_begin, new_end, exclude_end?)
46
44
  end
47
45
  end
@@ -2,27 +2,25 @@
2
2
 
3
3
  if defined?(ActiveJob::Base)
4
4
  ActiveJob::Base.class_eval do
5
- unless method_defined?(:remove_reserved_keywords)
6
- # Removes any reserved keywords that can't be passed along.
7
- #
8
- # @param arguments [...]
9
- #
10
- # @return [String, Numeric, Hash, Array, nil]
11
- #
12
- def remove_reserved_keywords(arguments)
13
- case arguments
14
- when String, Numeric
15
- arguments
16
- when Hash
17
- arguments.each_with_object({}) do |(key, value), obj|
18
- next if key.start_with?('_aj')
5
+ # Removes any reserved keywords that can't be passed along.
6
+ #
7
+ # @param arguments [...]
8
+ #
9
+ # @return [String, Numeric, Hash, Array, nil]
10
+ #
11
+ def remove_reserved_keywords(arguments)
12
+ case arguments
13
+ when String, Numeric
14
+ arguments
15
+ when Hash
16
+ arguments.each_with_object({}) do |(key, value), obj|
17
+ next if key.start_with?('_aj')
19
18
 
20
- obj[key] = remove_reserved_keywords(value)
21
- end
22
- when Array
23
- arguments.map do |arg|
24
- remove_reserved_keywords(arg)
25
- end
19
+ obj[key] = remove_reserved_keywords(value)
20
+ end
21
+ when Array
22
+ arguments.map do |arg|
23
+ remove_reserved_keywords(arg)
26
24
  end
27
25
  end
28
26
  end
@@ -2,13 +2,11 @@
2
2
 
3
3
  Time.class_eval do
4
4
  class << self
5
- unless method_defined?(:safe_parse)
6
- # Parses the `str` and returns `nil` if invalid
7
- def safe_parse(str)
8
- parse(str)
9
- rescue
10
- nil
11
- end
5
+ # Parses the `str` and returns `nil` if invalid
6
+ def safe_parse(str)
7
+ parse(str)
8
+ rescue
9
+ nil
12
10
  end
13
11
  end
14
12
  end
@@ -16,13 +14,11 @@ end
16
14
  if defined?(ActiveSupport::TimeZone)
17
15
  ActiveSupport::TimeZone.class_eval do
18
16
  class << self
19
- unless method_defined?(:safe_parse)
20
- # Parses the `str` and returns `nil` if invalid
21
- def safe_parse(str)
22
- parse(str)
23
- rescue
24
- nil
25
- end
17
+ # Parses the `str` and returns `nil` if invalid
18
+ def safe_parse(str)
19
+ parse(str)
20
+ rescue
21
+ nil
26
22
  end
27
23
  end
28
24
  end
@@ -30,13 +26,11 @@ end
30
26
 
31
27
  Date.class_eval do
32
28
  class << self
33
- unless method_defined?(:safe_parse)
34
- # Parses the `str` and returns `nil` if invalid
35
- def safe_parse(str)
36
- parse(str)
37
- rescue
38
- nil
39
- end
29
+ # Parses the `str` and returns `nil` if invalid
30
+ def safe_parse(str)
31
+ parse(str)
32
+ rescue
33
+ nil
40
34
  end
41
35
  end
42
36
  end
@@ -1,11 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Enumerable.class_eval do
4
- if method_defined?(:compact_blank) && !method_defined?(:select_present)
5
- alias_method :select_present, :compact_blank
6
- end
4
+ alias_method :select_present, :compact_blank
7
5
 
8
- if method_defined?(:compact_blank!) && !method_defined?(:select_present!)
9
- alias_method :select_present!, :compact_blank!
10
- end
6
+ alias_method :select_present!, :compact_blank!
11
7
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Enumerable.class_eval do
4
- if method_defined?(:compact_blank_join) && !method_defined?(:select_present_join)
5
- alias_method :select_present_join, :compact_blank_join
6
- end
4
+ alias_method :select_present_join, :compact_blank_join
7
5
  end
@@ -3,9 +3,7 @@
3
3
  require 'forwardable'
4
4
 
5
5
  Set.class_eval do
6
- unless method_defined?(:to_sentence)
7
- extend Forwardable
6
+ extend Forwardable
8
7
 
9
- def_delegators :to_a, :to_sentence
10
- end
8
+ def_delegators :to_a, :to_sentence
11
9
  end