lib/vitals/utils.rb in vitals-0.4.0 vs lib/vitals/utils.rb in vitals-0.5.0
- old
+ new
@@ -12,12 +12,13 @@
(1000.0 * sec).round
end
# XXX grape specific, move this away some day?
def self.grape_path(route)
version = route.route_version
- path = route.route_path.dup[1..-1]
- path.sub!(/\(\..*\)$/, '')
- path.sub!(":version", version) if version
+ path = route.route_path.dup[1..-1] # /foo/bar/baz -> foo/bar/baz
+ path.sub!(/\(\..*\)$/, '') # (.json) -> ''
+ path.sub!(":version", version) if version # :version -> v1
+ path.gsub!(/\//, ".") # foo/bar -> foo.bar
path.gsub!(/\//, ".")
path
end
end
end