mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
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
This commit is contained in:
parent
6aba260491
commit
f93a7e8b41
@ -29,8 +29,8 @@ module ActiveModel
|
||||
base._attributes = self._attributes.try(:dup) || []
|
||||
base._attributes_keys = self._attributes_keys.try(:dup) || {}
|
||||
base._urls = []
|
||||
serializer_file = File.open(caller.first[/^[^:]+/])
|
||||
base._cache_digest = Digest::MD5.hexdigest(serializer_file.read)
|
||||
serializer_file_path = caller.first[/\A\S+(?=:\d+:in)/]
|
||||
base._cache_digest = Digest::MD5.hexdigest(File.read(serializer_file_path))
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user