mirror of
https://github.com/meineerde/rackstash.git
synced 2026-02-06 09:03:22 +00:00
Replace overwritten conversion methods with implicit method to retain expected method behavior
This commit is contained in:
parent
2cff0cb5fa
commit
f6453e0f47
@ -112,7 +112,7 @@ module Rackstash
|
||||
# object (when given).
|
||||
# @return [self]
|
||||
def concat(array, scope: nil)
|
||||
array = Array(normalize(array, wrap: false, scope: scope))
|
||||
array = implicit(normalize(array, wrap: false, scope: scope))
|
||||
@raw.concat(array)
|
||||
self
|
||||
end
|
||||
@ -160,7 +160,7 @@ module Rackstash
|
||||
|
||||
private
|
||||
|
||||
def Array(obj)
|
||||
def implicit(obj)
|
||||
return obj.to_ary if obj.respond_to?(:to_ary)
|
||||
raise TypeError, "no implicit conversion of #{obj.class} into Array"
|
||||
end
|
||||
|
||||
@ -158,7 +158,7 @@ module Rackstash
|
||||
#
|
||||
# @return [self]
|
||||
def merge!(hash, force: true, scope: nil)
|
||||
hash = Hash(normalize(hash, scope: scope, wrap: false))
|
||||
hash = implicit(normalize(hash, scope: scope, wrap: false))
|
||||
|
||||
if force
|
||||
forbidden = @forbidden_keys & hash.keys
|
||||
@ -223,7 +223,7 @@ module Rackstash
|
||||
|
||||
private
|
||||
|
||||
def Hash(obj)
|
||||
def implicit(obj)
|
||||
return obj.to_hash if obj.respond_to?(:to_hash)
|
||||
raise TypeError, "no implicit conversion of #{obj.class} into Hash"
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user