Guest User

Untitled

a guest
Aug 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #! ruby
  2. #
  3. # Gets the unique OPC methods from the OPC analyzer trace log of all the methods TopView Configurator and Engine uses
  4.  
  5. # Assumes that it has been given a valid file name
  6. if ARGV.length == 1 and File.exists?(ARGV[0])
  7. input = File.open(ARGV.first, "r").read
  8.  
  9. # Build up a unique array of OPC methods
  10. opc_methods = []
  11.  
  12. # For each line in the file, pull out the package::method name string and put it in the opc_methods collection
  13. input.lines.each do |line|
  14. if match = line.match(/\w+\:\:\w+/).to_s and !opc_methods.include?(match)
  15. opc_methods << match
  16. end
  17. end
  18.  
  19. # Chop out all the repeats and print the unique method names
  20. puts "Unique OPC method calls:"
  21. opc_methods.each do |method_name|
  22. puts "#{method_name}\n"
  23. end
  24.  
  25. else
  26. puts "Please give me the name of a valid file!"
  27. end
Add Comment
Please, Sign In to add comment