Created
January 9, 2013 23:30
-
-
Save sohocoke/4498009 to your computer and use it in GitHub Desktop.
apunixenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!~/.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