Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgaufman/d6e5f17bf06d078830937a644612ef80 to your computer and use it in GitHub Desktop.
Save rgaufman/d6e5f17bf06d078830937a644612ef80 to your computer and use it in GitHub Desktop.

Can you write a simple Ruby parse that will turn the following string:

	Events[0].Lane=1
	Events[0].Object.BoundingBox[0]=1248
	Events[0].Object.BoundingBox[1]=3528
	Events[0].Object.BoundingBox[2]=1920
	Events[0].Object.BoundingBox[3]=3848
	Events[0].Object.Center[0]=1584
	Events[0].Object.Country=GBR
	Events[0].SnapSourceCombine=false

Into this Ruby hash:

	hash = {
	  'Lane' = 1,
	  'SnapSourceCombine' => false
	  'Object' => {
		'BoundingBox' => [1248, 3528, 1920, 3848],
                'Center' => [1584],
		'Country' => 'GBR',
	  }
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment