DEV: Apply syntax_tree formatting to script/*

This commit is contained in:
David Taylor
2023-01-07 11:53:14 +00:00
parent ff508d1ae5
commit 436b3b392b
143 changed files with 8905 additions and 7353 deletions

View File

@ -1,9 +1,8 @@
# frozen_string_literal: true
require 'uri'
require "uri"
class CreateTitle
def self.from_body(body)
title = remove_mentions body
title = remove_urls title
@ -24,11 +23,11 @@ class CreateTitle
private
def self.remove_mentions(text)
text.gsub(/@[\w]*/, '')
text.gsub(/@[\w]*/, "")
end
def self.remove_urls(text)
text.gsub(URI::regexp(['http', 'https', 'mailto', 'ftp', 'ldap', 'ldaps']), '')
text.gsub(URI.regexp(%w[http https mailto ftp ldap ldaps]), "")
end
def self.remove_stray_punctuation(text)
@ -42,7 +41,7 @@ class CreateTitle
end
def self.complete_sentences(text)
/(^.*[\S]{2,}[.!?:]+)\W/.match(text[0...80] + ' ')
/(^.*[\S]{2,}[.!?:]+)\W/.match(text[0...80] + " ")
end
def self.complete_words(text)