mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 00:55:11 -07:00
Fix warning about block and default value
Ruby's Array#fetch accepts either a default value or a block, but not both. If both are passed in, then it uses the block and outputs this warning: ``` lib/liquid/static_registers.rb:34: warning: block supersedes default value argument ```
This commit is contained in:
@@ -31,7 +31,11 @@ module Liquid
|
|||||||
if @registers.key?(key)
|
if @registers.key?(key)
|
||||||
@registers.fetch(key)
|
@registers.fetch(key)
|
||||||
elsif default != UNDEFINED
|
elsif default != UNDEFINED
|
||||||
@static.fetch(key, default, &block)
|
if block_given?
|
||||||
|
@static.fetch(key, &block)
|
||||||
|
else
|
||||||
|
@static.fetch(key, default)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
@static.fetch(key, &block)
|
@static.fetch(key, &block)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user