How would I go about removing all empty elements (empty list items) from a nested Hash or YAML file?
Try this to remove nil
hash = { a: true, b: false, c: nil } => {:a=>true, :b=>false, :c=>nil} hash.inject({}){|c, (k, v)| c[k] = v unless v.nil?; c} => {:a=>true, :b=>false}