Find file
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (18 sloc) 742 Bytes
Hello -
This project is currently a prototype! I'm just trying to get my ideas together in one place.
But, the idea is to have something like this in JRuby:
modify :classes=>/com\.quadcs\.hacksaw\.demo\.DemoAccount/ do |c|
c.add_field 'public int z = 0;'
c.modify :field=>"accountNumber" do |f|
f.change_modifiers [:public]
end
c.modify :method=>"isValidAccount" do |m|
m.add_line_before 'if(accountNumber.equals("abcd")) { return true; }'
end
c.add_method 'public String somethingNew(int dx) { return accountNumber + "." + z + "." + dx; }'
end
# Append this to the JVM options when JRuby is started:
# -J-javaagent:/path/to/Hacksaw.jar
See the demo directory!
Cheers!
Dave