Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. # 1. Create a file called mygame/app/repl.rb
  2. # 2. Start up the GTK environment.
  3. # 3. Change the line at the bottom of this file.
  4. # 4. Save repl.rb.
  5.  
  6. # Explanation:
  7. # The code below tells GTK to give me all private member variables that have a public method,
  8. # and for those member variables, execute the public method, then call `.help` on whatever
  9. # that public method returned. Then finally save the help result to a file.
  10.  
  11. def export_help_for_instance_variable o, ivar
  12. attr_name = ivar.to_s.gsub("@", "").to_sym
  13. if o.respond_to? attr_name
  14. output_file_name = "app/help-#{attr_name}.txt"
  15. .gsub("--", "-")
  16. .gsub("class", "")
  17. .gsub(":", "")
  18. .gsub(" ", "")
  19. .gsub("(", "")
  20. .gsub(")", "")
  21.  
  22. $gtk.ffi_file.storefile output_file_name, o.send(attr_name).help
  23. end
  24. end
  25.  
  26. def export_help_for_instance_variables o
  27. o.instance_variables.sort.map do |ivar|
  28. export_help_for_instance_variable o, ivar
  29. end
  30. end
  31.  
  32. # Change the line below to things like $gtk, $gtk.args, $gtk.args.keyboard, etc
  33. export_help_for_instance_variables $gtk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement