require 'json' module Charred module Custom def load_custom(data) Dir.glob("data/custom/**/*") { |file| if File.file?(file) case File.extname(file) when ".skills" verbose_merge data[:skills], json_get(file) when ".traits" verbose_merge data[:traits], json_get(file) when ".stock" stock = Stock.new(json_get(file)) data[:stocks].deep_merge!({ stock.key => stock }) when ".lifepaths" contents = json_get(file) data[:lifepaths].deep_merge!({ contents["stock"] => contents["settings"]}) when ".resources" contents = json_get(file) data[:resources].deep_merge!({ contents["stock"] => contents["resources"]}) end end } end end end