Skip to content

Instantly share code, notes, and snippets.

@sohocoke
Created January 9, 2013 23:30
Show Gist options
  • Save sohocoke/4498009 to your computer and use it in GitHub Desktop.
Save sohocoke/4498009 to your computer and use it in GitHub Desktop.
apunixenv
#!~/.rvm/bin/rvm-auto-ruby
#
# transforms common data structures to from one format to another
#
# plist, yaml, json
#
def xform( data, input_format, output_format )
case input_format
when :plist
xformer = plist_xformer_for :plist
output = xformer.xform
results = {
output: output,
data: data # might be big
formats: {
in: :plist,
out: xformer.format
}
}
# ... and so on, we implement stuff for yaml, json, any other format for hierarchical structures built mainly with lists and dictionaries.
else
end
end
# general-purpose code to bridge system and program environments.
#
# handle ARGS
# handle output
# map errors
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment