phlex 1.9.1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of phlex might be problematic. Click here for more details.

data/lib/phlex/helpers.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
4
- using Phlex::Overrides::Symbol::Name
5
- end
3
+ require "set"
6
4
 
7
5
  module Phlex::Helpers
8
6
  private
@@ -80,9 +78,23 @@ module Phlex::Helpers
80
78
  when Hash
81
79
  old.is_a?(Hash) ? mix(old, new) : new
82
80
  when Array
83
- old.is_a?(Array) ? (old + new) : new
81
+ case old
82
+ when Array then old + new
83
+ when Set then old.to_a + new
84
+ when Hash then new
85
+ else
86
+ [old] + new
87
+ end
88
+ when Set
89
+ case old
90
+ when Set then old + new
91
+ when Array then old + new.to_a
92
+ when Hash then new
93
+ else
94
+ new + [old]
95
+ end
84
96
  when String
85
- old.is_a?(String) ? "#{old} #{new}" : new
97
+ old.is_a?(String) ? "#{old} #{new}" : old + old.class[new]
86
98
  else
87
99
  new
88
100
  end