Created
September 24, 2012 12:22
-
-
Save JakeCoxon/3775689 to your computer and use it in GitHub Desktop.
Ruby + Java file
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
//;" | |
/*" | |
code = <<-CODE.chop | |
class AJavaClass { | |
public static void main(String[] args) { | |
System.out.println("#{Random.rand(100)}"); | |
} | |
} | |
CODE | |
file = IO.read(__FILE__) | |
IO.write("#{__FILE__}.bak", file) | |
file.sub!(%r{(?<=^// BEGIN GEN\n)[\s\S]*(?=\n^// END GEN)}, code) | |
IO.write(__FILE__, file) | |
puts "Done" | |
=begin */ | |
// BEGIN GEN | |
class AJavaClass { | |
public static void main(String[] args) { | |
System.out.println("38"); | |
} | |
} | |
// END GEN | |
/* | |
=end | |
#*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment