lib/phlex/helpers.rb in phlex-1.9.3 vs lib/phlex/helpers.rb in phlex-1.10.0

- old
+ new

@@ -1,10 +1,8 @@ # frozen_string_literal: true -if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0") - using Phlex::Overrides::Symbol::Name -end +require "set" module Phlex::Helpers private # Tokens @@ -78,12 +76,26 @@ result.merge!(object) do |_key, old, new| case new when Hash old.is_a?(Hash) ? mix(old, new) : new when Array - old.is_a?(Array) ? (old + new) : new + case old + when Array then old + new + when Set then old.to_a + new + when Hash then new + else + [old] + new + end + when Set + case old + when Set then old + new + when Array then old + new.to_a + when Hash then new + else + new + [old] + end when String - old.is_a?(String) ? "#{old} #{new}" : new + old.is_a?(String) ? "#{old} #{new}" : old + old.class[new] else new end end