lib/precedences/precedence.rb in precedences-1.7.0 vs lib/precedences/precedence.rb in precedences-1.7.1
- old
+ new
@@ -179,11 +179,11 @@
# Else (default) add at the bottom
#
attr_reader :added_choices_before
attr_reader :added_choices_after
def add(name, value, **params)
- @added_choices_before = []
- @added_choices_after = []
+ @added_choices_before ||= []
+ @added_choices_after ||= []
name.is_a?(String) || raise(ArgumentError.new("First argument should be a String."))
lechoix = {name: name, value: value}
if params[:at_top]
@added_choices_before << lechoix
else