Skip to content

Commit f93a7e8

Browse files
committed
need lookahead match for windows file path contain 'c:/git/'
So we will got full file path instead of only c if caller.first is: c:/git/emberjs/ember-crm-backend/app/serializers/lead_serializer.rb:1:in `<top (required)>' CALLER_FILE = / /A # start of string \S+ # one or more non-spaces (?= # stop previous match when :\d+:in # a colon is followed by one or more digits # followed by a colon followed by in ) /x credit from https://gist.github.com/mikezter/540132 and @bf4
1 parent 6aba260 commit f93a7e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/active_model/serializer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def self.inherited(base)
2929
base._attributes = self._attributes.try(:dup) || []
3030
base._attributes_keys = self._attributes_keys.try(:dup) || {}
3131
base._urls = []
32-
serializer_file = File.open(caller.first[/^[^:]+/])
33-
base._cache_digest = Digest::MD5.hexdigest(serializer_file.read)
32+
serializer_file_path = caller.first[/\A\S+(?=:\d+:in)/]
33+
base._cache_digest = Digest::MD5.hexdigest(File.read(serializer_file_path))
3434
super
3535
end
3636

0 commit comments

Comments
 (0)