mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 21:19:32 +08:00
DEV: Prefer public_send
over send
.
This commit is contained in:
@ -11,7 +11,7 @@ module ImportScripts
|
||||
|
||||
def initialize(cols)
|
||||
cols.each_with_index do |col, idx|
|
||||
self.class.send(:define_method, col.downcase.gsub(/[\W]/, '_').squeeze('_')) do
|
||||
self.class.public_send(:define_method, col.downcase.gsub(/[\W]/, '_').squeeze('_')) do
|
||||
@row[idx]
|
||||
end
|
||||
end
|
||||
|
@ -44,7 +44,7 @@ class ImportScripts::Bespoke < ImportScripts::Base
|
||||
|
||||
def initialize(cols)
|
||||
cols.each_with_index do |col, idx|
|
||||
self.class.send(:define_method, col) do
|
||||
self.class.public_send(:define_method, col) do
|
||||
@row[idx]
|
||||
end
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ class ImportScripts::Jive < ImportScripts::Base
|
||||
|
||||
def initialize(cols)
|
||||
cols.each_with_index do |col, idx|
|
||||
self.class.send(:define_method, col) do
|
||||
self.class.public_send(:define_method, col) do
|
||||
@row[idx]
|
||||
end
|
||||
end
|
||||
|
@ -48,7 +48,7 @@ class Mapping
|
||||
def initialize(lines)
|
||||
|
||||
FIELDS.each do |field|
|
||||
self.send("#{field}=", 0)
|
||||
self.public_send("#{field}=", 0)
|
||||
end
|
||||
|
||||
parse_first_line(lines.shift)
|
||||
@ -72,7 +72,7 @@ class Mapping
|
||||
field = parts[0].downcase.sub(':', '')
|
||||
if respond_to? "#{field}="
|
||||
value = Float(parts[1]).to_i
|
||||
self.send("#{field}=", value)
|
||||
self.public_send("#{field}=", value)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -81,7 +81,7 @@ def consume_mapping(map_lines, totals)
|
||||
m = Mapping.new(map_lines)
|
||||
|
||||
Mapping::FIELDS.each do |field|
|
||||
totals[field] += m.send(field)
|
||||
totals[field] += m.public_send(field)
|
||||
end
|
||||
return m
|
||||
end
|
||||
|
Reference in New Issue
Block a user