forked from e621ng/e621ng
[Cleanup] Resolve some easy ruby warnings
Mostly duplicate method warnings
This commit is contained in:
parent
f51e0e85cf
commit
a7ef80074d
@ -10,15 +10,15 @@ module Danbooru
|
||||
def has_bit_flags(attributes, options = {})
|
||||
field = options[:field] || :bit_flags
|
||||
|
||||
attributes.each.with_index do |attribute, i|
|
||||
bit_flag = 1 << i
|
||||
|
||||
define_singleton_method("flag_value_for") do |key|
|
||||
index = attributes.index(key)
|
||||
raise IndexError if index.nil?
|
||||
1 << index
|
||||
end
|
||||
|
||||
attributes.each.with_index do |attribute, i|
|
||||
bit_flag = 1 << i
|
||||
|
||||
define_method(attribute) do
|
||||
send(field) & bit_flag > 0
|
||||
end
|
||||
|
@ -97,7 +97,6 @@ class StorageManager
|
||||
|
||||
def protected_params(url, post, secret: Danbooru.config.protected_file_secret)
|
||||
user_id = CurrentUser.id
|
||||
ip = CurrentUser.ip_addr
|
||||
time = (Time.now + 15.minute).to_i
|
||||
secret = secret
|
||||
hmac = Digest::MD5.base64digest("#{time} #{url} #{user_id} #{secret}").tr("+/","-_").gsub("==",'')
|
||||
|
@ -196,14 +196,6 @@ class ForumPost < ApplicationRecord
|
||||
self.is_hidden = false if is_hidden.nil?
|
||||
end
|
||||
|
||||
def creator_name
|
||||
User.id_to_name(creator_id)
|
||||
end
|
||||
|
||||
def updater_name
|
||||
User.id_to_name(updater_id)
|
||||
end
|
||||
|
||||
def forum_topic_page
|
||||
(ForumPost.where("topic_id = ? and created_at <= ?", topic_id, created_at).count / Danbooru.config.records_per_page.to_f).ceil
|
||||
end
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<%= render "layouts/head" %>
|
||||
</head>
|
||||
<%= tag.body **body_attributes(CurrentUser.user) do %>
|
||||
<%= tag.body(**body_attributes(CurrentUser.user)) do %>
|
||||
<%= render "layouts/theme_include" %>
|
||||
|
||||
<header id="top">
|
||||
|
@ -44,12 +44,6 @@ class ParseValueTest < ActiveSupport::TestCase
|
||||
assert_equal(0.0, eq_value("10:0", :ratio))
|
||||
end
|
||||
|
||||
should "parse floats" do
|
||||
assert_equal(10.0, eq_value("10", :float))
|
||||
assert_equal(0.1, eq_value(".1", :float))
|
||||
assert_equal(1.234, eq_value("1.234", :float))
|
||||
end
|
||||
|
||||
should "parse filesizes" do
|
||||
assert_equal(10, eq_value("10", :filesize))
|
||||
assert_equal(102, eq_value(".1kb", :filesize))
|
||||
|
Loading…
Reference in New Issue
Block a user