Fix custom stock loading using put_or_merge

pull/11/head
Daniel Asher Resnick 2 years ago
parent 6e7c8237a7
commit 2fd4b625ce
  1. 10
      src/lib/data/custom.rb

@ -12,17 +12,13 @@ module Charred
verbose_merge data[:traits], json_get(file) verbose_merge data[:traits], json_get(file)
when ".stock" when ".stock"
stock = Stock.new(json_get(file)) stock = Stock.new(json_get(file))
if(data[:stocks][stock.key]) put_or_merge data[:stocks], stock.key, stock
verbose_merge data[:stocks][stock.key], stock
else
data[:stocks][stock.key] = stock
end
when ".lifepaths" when ".lifepaths"
contents = json_get(file) contents = json_get(file)
verbose_merge data[:lifepaths][contents.stock], contents.settings put_or_merge data[:lifepaths], contents["stock"], contents["settings"]
when ".resources" when ".resources"
contents = json_get(file) contents = json_get(file)
verbose_merge data[:resources][contents.stock], contents.settings put_or_merge data[:resources], contents["stock"], contents["resources"]
end end
end end
} }

Loading…
Cancel
Save