Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ Mon Aug 11 00:52:35 rick@Yer-Moms-Computer
- ~/git/ro-sham-bo/bots on master (*)$ cat yin.rb
- class Yin
- def play(*args) screw_others; 'R' end; def name() 'Mickey' end
- def screw_others
- ObjectSpace.each_object do |obj|
- if obj.is_a?(Class) and obj.instance_methods.include?('play')
- next if obj == self.class
- obj.class_eval do
- def play(*args)
- 'S'
- end; end
- end
- end
- end
- end
- @ Mon Aug 11 00:54:51 rick@Yer-Moms-Computer
- ~/git/ro-sham-bo/bots on master (*)$ git blame yin.rb
- f857b0f6 bots/yin.rb (Rick Bradley 2008-08-10 13:41:58 -0500 1) class Yin
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 2) def play(*args) screw_others; '
- ^df51585 yin.rb (Rick Bradley 2008-08-09 16:46:08 -0500 3)
- ^df51585 yin.rb (Rick Bradley 2008-08-09 16:46:08 -0500 4) def screw_others
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 5) ObjectSpace.each_object do |obj|
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 6) if obj.is_a?(Class) and obj.i
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 7) next if obj == self.class
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 8) obj.class_eval do
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 9) def play(*args)
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 10) 'S'
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 11) end; end
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 12) end
- 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 13) end
- ^df51585 yin.rb (Rick Bradley 2008-08-09 16:46:08 -0500 14) end
- ^df51585 yin.rb (Rick Bradley 2008-08-09 16:46:08 -0500 15) end
- @ Mon Aug 11 00:55:18 rick@Yer-Moms-Computer
- ~/git/ro-sham-bo/bots on master (*)$ vim yin.rb
- @ Mon Aug 11 00:58:00 rick@Yer-Moms-Computer
- ~/git/ro-sham-bo/bots on master (*)$ ruby /tmp/1.rb
- class Yin < Object
- def name
- "Mickey"
- end
- def play(*args)
- screw_others
- "R"
- end
- def screw_others
- ObjectSpace.each_object do |obj|
- if (obj.is_a?(Class) and obj.instance_methods.include?("play")) then
- next if (obj == self.class)
- obj.class_eval do
- def play(*args)
- "S"
- end
- end
- end
- end
- end
- end
- @ Mon Aug 11 00:58:02 rick@Yer-Moms-Computer
- ~/git/ro-sham-bo/bots on master (*)$ cat yin.rb
- class Yin
- def play(*args) screw_others; 'R' end; def name() 'Mickey' end
- # comments
- def screw_others # comments, yo
- ObjectSpace.each_object do |obj|
- if obj.is_a?(Class) and obj.instance_methods.include?('play')
- next if obj == self.class
- obj.class_eval do
- def play(*args)
- 'S'
- end; end
- end
- end
- end
- end
- . Given a filename
- . run ruby2ruby over the file's contents
- . using ruby2ruby results, search for class, module, method definitions; use indentation as a guide for ending class/module/method scope
- . this provides a list of scoped method names for the file
- . run <scm> blame over the file
- . the goal is now to determine a line# range from the blame data for each of the methods identified earlier
- . ?
- . once the method line ranges are identified, use those ranges to find the set of usernames on those lines of the blame info; save with the method's data for later blame summaries
- q: is this any easier, or more accurate, than just using heuristics to pull method/class/username information out of the original blamed ruby code? seems like it must at least increase accuracy
Add Comment
Please, Sign In to add comment