assets/src/ruboto/activity.rb in ruboto-0.15.0 vs assets/src/ruboto/activity.rb in ruboto-0.16.0
- old
+ new
@@ -60,12 +60,13 @@
script_name = options.delete(:script)
extras = options.delete(:extras)
raise "Unknown options: #{options}" unless options.empty?
if class_name.nil? && block_given?
+ src_desc = source_descriptor(block)
class_name =
- "#{java_class.name.split('::').last}_#{source_descriptor(block)[0].split('/').last.gsub(/[.-]+/, '_')}_#{source_descriptor(block)[1]}"
+ "#{java_class.name.split('::').last}_#{src_desc[0].split('/').last.gsub(/[.-]+/, '_')}_#{src_desc[1]}"
end
class_name = class_name.to_s
if Object.const_defined?(class_name)
@@ -83,11 +84,11 @@
self
end
private
- def source_descriptor(proc)
- if md = /^#<Proc:0x[0-9A-Fa-f]+@(.+):(\d+)(?: \(lambda\))?>$/.match(proc.inspect)
+ def source_descriptor(src_proc)
+ if (md = /^#<Proc:0x[0-9A-Fa-f-]+@(.+):(\d+)(?: \(lambda\))?>$/.match(src_proc.inspect))
filename, line = md.captures
return filename, line.to_i
end
end