Skip to content

Instantly share code, notes, and snippets.

@jasmarc
Created July 31, 2010 17:03
Show Gist options
  • Save jasmarc/502374 to your computer and use it in GitHub Desktop.
Save jasmarc/502374 to your computer and use it in GitHub Desktop.
require 'yaml'
def top(clazz)
<<EOF
using Put.Usings.Here;
namespace Your.Namespace.Here
{
public class #{clazz}
{
EOF
end
def prop(var, typ)
<<EOF
public #{typ} #{var} { get; set; }
EOF
end
def endd
<<EOF
}
}
EOF
end
File.open("API.yaml") do |ydoc|
YAML.load(ydoc).each_pair do |clazz, properties|
puts top clazz
properties.each_pair do |var,typ|
puts prop(var, typ)
end
puts endd
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment