Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(ruby gems) warning: duplicated key at line 46 ignored: "index0"

Attempting to run Jekyll commands and receiving this warning each time.

.rvm/gems/ruby-2.2.0/gems/liquid-2.6.1/lib/liquid/htmltags.rb:43: warning: duplicated key at line 46 ignored: "index0"

Troubleshooting: I updated gems, ran bundle install, jekyll update and reinstalled Python. Is there a way I can manually remove the duplicated key in htmltags.rb?

like image 325
tonyynot Avatar asked Dec 15 '25 13:12

tonyynot


2 Answers

The simplest thing would be to update to liquid 2.6.2, which fixes this (the fix is in this commit)

The warning itself is new ruby 2.2, although actual behaviour is the same - previous versions just ignored such situations.

like image 130
Frederick Cheung Avatar answered Dec 17 '25 12:12

Frederick Cheung


Yes, although the warning is not dangerous. When using the {} syntax to define a hash, It is always the last value of a duplicate key which is used, and all previous values are simply ignored. It's safe to edit the code yourself in order to clear the warning, as long as you're careful not to remove the last or only value of a key.

Keep in mind that the "ignored" key may not actually be on the same line as the warning message indicates if the hash definition spans multiple lines.

Which value for a duplicate key is ignored in a Ruby hash?

like image 20
emery Avatar answered Dec 17 '25 13:12

emery



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!