lib/appmap/util.rb in appmap-0.65.1 vs lib/appmap/util.rb in appmap-0.66.0
- old
+ new
@@ -19,9 +19,19 @@
MAGENTA = "\e[35m"
CYAN = "\e[36m"
WHITE = "\e[37m"
class << self
+ def parse_function_name(name)
+ package_tokens = name.split('/')
+
+ class_and_name = package_tokens.pop
+ class_name, function_name, static = class_and_name.include?('.') ? class_and_name.split('.', 2) + [ true ] : class_and_name.split('#', 2) + [ false ]
+
+ raise "Malformed fully-qualified function name #{name}" unless function_name
+ [ package_tokens.empty? ? 'ruby' : package_tokens.join('/'), class_name, static, function_name ]
+ end
+
# scenario_filename builds a suitable file name from a scenario name.
# Special characters are removed, and the file name is truncated to fit within
# shell limitations.
def scenario_filename(name, max_length: 255, separator: '_', extension: '.appmap.json')
# Cribbed from v5 version of ActiveSupport:Inflector#parameterize: