Skip to content

Instantly share code, notes, and snippets.

Created July 3, 2012 02:23
Show Gist options
  • Save anonymous/3037130 to your computer and use it in GitHub Desktop.
Save anonymous/3037130 to your computer and use it in GitHub Desktop.
testing activegist
property = [:algo, :face, :lo]
puts suffix_property_id =
property.inject { |memo, prop| "#{memo}_#{prop}"}
model = {algo: {otro: 'cantelas', face: {lo: 'lu'}}}
def unwrap model, property, index = 0
if index < property.length - 1
puts property[index]
next_model = model[property[index]]
unwrap next_model, property, index + 1
else
model[property[index]]
end
end
puts(unwrap model, property)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment