Guest User

Untitled

a guest
Feb 19th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. @ Mon Aug 11 00:52:35 rick@Yer-Moms-Computer
  2. ~/git/ro-sham-bo/bots on master (*)$ cat yin.rb
  3. class Yin
  4. def play(*args) screw_others; 'R' end; def name() 'Mickey' end
  5.  
  6. def screw_others
  7. ObjectSpace.each_object do |obj|
  8. if obj.is_a?(Class) and obj.instance_methods.include?('play')
  9. next if obj == self.class
  10. obj.class_eval do
  11. def play(*args)
  12. 'S'
  13. end; end
  14. end
  15. end
  16. end
  17. end
  18. @ Mon Aug 11 00:54:51 rick@Yer-Moms-Computer
  19. ~/git/ro-sham-bo/bots on master (*)$ git blame yin.rb
  20. f857b0f6 bots/yin.rb (Rick Bradley 2008-08-10 13:41:58 -0500 1) class Yin
  21. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 2) def play(*args) screw_others; '
  22. ^df51585 yin.rb (Rick Bradley 2008-08-09 16:46:08 -0500 3)
  23. ^df51585 yin.rb (Rick Bradley 2008-08-09 16:46:08 -0500 4) def screw_others
  24. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 5) ObjectSpace.each_object do |obj|
  25. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 6) if obj.is_a?(Class) and obj.i
  26. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 7) next if obj == self.class
  27. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 8) obj.class_eval do
  28. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 9) def play(*args)
  29. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 10) 'S'
  30. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 11) end; end
  31. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 12) end
  32. 00000000 bots/yin.rb (Not Committed Yet 2008-08-11 00:55:12 -0500 13) end
  33. ^df51585 yin.rb (Rick Bradley 2008-08-09 16:46:08 -0500 14) end
  34. ^df51585 yin.rb (Rick Bradley 2008-08-09 16:46:08 -0500 15) end
  35. @ Mon Aug 11 00:55:18 rick@Yer-Moms-Computer
  36. ~/git/ro-sham-bo/bots on master (*)$ vim yin.rb
  37. @ Mon Aug 11 00:58:00 rick@Yer-Moms-Computer
  38. ~/git/ro-sham-bo/bots on master (*)$ ruby /tmp/1.rb
  39. class Yin < Object
  40. def name
  41. "Mickey"
  42. end
  43.  
  44. def play(*args)
  45. screw_others
  46. "R"
  47. end
  48.  
  49. def screw_others
  50. ObjectSpace.each_object do |obj|
  51. if (obj.is_a?(Class) and obj.instance_methods.include?("play")) then
  52. next if (obj == self.class)
  53. obj.class_eval do
  54. def play(*args)
  55. "S"
  56. end
  57. end
  58. end
  59. end
  60. end
  61. end
  62. @ Mon Aug 11 00:58:02 rick@Yer-Moms-Computer
  63. ~/git/ro-sham-bo/bots on master (*)$ cat yin.rb
  64. class Yin
  65. def play(*args) screw_others; 'R' end; def name() 'Mickey' end
  66. # comments
  67. def screw_others # comments, yo
  68. ObjectSpace.each_object do |obj|
  69. if obj.is_a?(Class) and obj.instance_methods.include?('play')
  70. next if obj == self.class
  71. obj.class_eval do
  72. def play(*args)
  73. 'S'
  74. end; end
  75. end
  76. end
  77. end
  78. end
  79.  
  80.  
  81.  
  82. . Given a filename
  83. . run ruby2ruby over the file's contents
  84. . using ruby2ruby results, search for class, module, method definitions; use indentation as a guide for ending class/module/method scope
  85. . this provides a list of scoped method names for the file
  86. . run <scm> blame over the file
  87. . the goal is now to determine a line# range from the blame data for each of the methods identified earlier
  88. . ?
  89. . 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
  90.  
  91. 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