Skip to content

Instantly share code, notes, and snippets.

@xorrbit
Created April 14, 2012 15:07
Show Gist options
  • Save xorrbit/be04d574e2dba90ed240 to your computer and use it in GitHub Desktop.
Save xorrbit/be04d574e2dba90ed240 to your computer and use it in GitHub Desktop.
# this turns an ugly statement like this:
# payee_id = message.value[0].value[2].value[0].value[0].value[0].value[2].value
# into a somewhat less ugly statement:
# payee_id = asn1_data_lookup(message.value, [0,2,0,0,0,2,0])
def asn1_data_lookup(message, indices)
indices.each do |index|
message = message[index].value
end
message
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment