Skip to content

Instantly share code, notes, and snippets.

@roolo
Created February 2, 2012 19:28
Show Gist options
  • Select an option

  • Save roolo/1725258 to your computer and use it in GitHub Desktop.

Select an option

Save roolo/1725258 to your computer and use it in GitHub Desktop.
def flatten_nested_groups
self.document.css('g g:only-child').each do |nested_group|
nested_group.attributes.each do |attr, attr_obj|
nested_group.parent.attributes[attr] = attr_obj
end
nested_group.remove
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment