summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2015-12-13 13:29:59 +0100
committerAlex Legler <alex@a3li.li>2015-12-13 13:29:59 +0100
commit1f4743f2ae61a7f443980359303d6d631b2426fc (patch)
treedb1a8aafc861eb8fcbf15993090784fa86a55eea /lib/helpers.rb
parentUse protocol-relative URI for the favicon (diff)
downloadfrontend-1f4743f2ae61a7f443980359303d6d631b2426fc.tar.gz
frontend-1f4743f2ae61a7f443980359303d6d631b2426fc.tar.bz2
frontend-1f4743f2ae61a7f443980359303d6d631b2426fc.zip
Style fixes
Diffstat (limited to 'lib/helpers.rb')
-rw-r--r--lib/helpers.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/helpers.rb b/lib/helpers.rb
index 873d50f..3ed4f51 100644
--- a/lib/helpers.rb
+++ b/lib/helpers.rb
@@ -8,7 +8,7 @@ helpers do
def list_check
unless [$config['active_lists'], $config['frozen_lists']].flatten.include?(params[:list])
status 404
- body "List not found"
+ body 'List not found'
return false
end
@@ -16,9 +16,9 @@ helpers do
end
def monthint_to_link(monthint)
- date = DateTime.parse("%s-%s-01" % [monthint[0..3], monthint[4..5]])
+ date = DateTime.parse('%s-%s-01' % [monthint[0..3], monthint[4..5]])
- "<a href=\"threads/%s/\">%s</a>" % [date.strftime('%Y-%m'), date.strftime('%Y %B')]
+ '<a href="threads/%s/">%s</a>' % [date.strftime('%Y-%m'), date.strftime('%Y %B')]
end
def date_format(date)
@@ -26,11 +26,11 @@ helpers do
end
def to_monthint(year, month)
- ("%i%02i" % [year.to_i, month.to_i]).to_i
+ ('%i%02i' % [year.to_i, month.to_i]).to_i
end
def to_month(year, month)
- date = DateTime.parse("%s-%s-01" % [year, month])
+ date = DateTime.parse('%s-%s-01' % [year, month])
date.strftime('%B %Y')
end
@@ -39,19 +39,19 @@ helpers do
end
def u(text)
- ERB::Util::url_encode(text)
+ ERB::Util.url_encode(text)
end
# This method strips domains from header fields.
def strip_email_headers(ary)
[ary].flatten.map do |email|
- email.gsub(/@(\S*?)('|"|>|$)/) do |s|
+ email.gsub(/@(\S*?)('|"|>|$)/) do
if $1 == 'gentoo.org'
"@g.o#{$2}"
elsif $1 == 'lists.gentoo.org'
"@l.g.o#{$2}"
else
- domain, dot, tld = $1.rpartition '.'
+ domain, _dot, tld = $1.rpartition '.'
"@#{'×' * domain.length}.#{tld}#{$2}"
end
end
@@ -60,10 +60,10 @@ helpers do
# This method is meant to strip emails from free text, not header fields
def strip_email(str)
- str.gsub(/([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+)\.([a-zA-Z]{2,10})/) do |s|
- if $2 == 'gentoo' and $3 == 'org'
+ str.gsub(/([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+)\.([a-zA-Z]{2,10})/) do
+ if $2 == 'gentoo' && $3 == 'org'
"#{$1}@g.o"
- elsif $2 == 'lists.gentoo' and $3 == 'org'
+ elsif $2 == 'lists.gentoo' && $3 == 'org'
"#{$1}@l.g.o"
else
"#{$1}@#{'×' * $2.length}.#{$3}"
@@ -76,7 +76,7 @@ helpers do
end
def msgid_to_gmane(msgid)
- GMANE_FIND + ERB::Util::url_encode(msgid)
+ GMANE_FIND + ERB::Util.url_encode(msgid)
end
def msgid_to_marc(msgid)
@@ -87,7 +87,7 @@ helpers do
# pan.2009.08.28.00.00.38@cox.net
# http://marc.info/?i=pan.2009.08.28.00.00.38%20()%20cox%20!%20net
local, host = msgid.split('@', 2)
- new_msgid = local + ' () ' + host.gsub('.',' ! ')
- MARC_FIND + ERB::Util::url_encode(new_msgid)
+ new_msgid = local + ' () ' + host.gsub('.', ' ! ')
+ MARC_FIND + ERB::Util.url_encode(new_msgid)
end
end