Skip to content

Commit

Permalink
Notice#method_signature support UUID, IP, HEXSTR
Browse files Browse the repository at this point in the history
  • Loading branch information
darkleaf committed Aug 29, 2014
1 parent 15f5006 commit 5789a53
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/models/notice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ def default_values

def message_signature
m = message.clone
m.gsub!(/".*?"/, '"%STR%"')
m.gsub!(/'.*?'/, '\'%STR%\'')
m.gsub!(/".+?"/, '"%STR%"')
m.gsub!(/'.+?'/, '\'%STR%\'')
m.gsub!(/\h{8}-\h{4}-\h{4}-\h{4}-\h{12}/, '%UUID%')
m.gsub!(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/, '%IP%')
m.gsub!(/0x\h+/, '%HEX%')
m.gsub!(/-?\d+/, '%NUM%')
m.gsub!(/\d+/, '%NUM%')
m.gsub!(/\h{7,}/, '%HEXSTR%')
m.truncate(150)
end

Expand Down

0 comments on commit 5789a53

Please sign in to comment.