They were added in Rubocop 1.24.0. Even if we were already applying FileRead everywhere, this is something we've manually fixed in the past. Another reason to add it is that these rules are deeply related.
22 lines
493 B
Ruby
22 lines
493 B
Ruby
module JsonExporter
|
|
def to_json_file(filename)
|
|
data = []
|
|
model.find_each { |record| data << json_values(record) }
|
|
File.write(filename, data.to_json)
|
|
end
|
|
|
|
private
|
|
|
|
def strip_tags(html_string)
|
|
ActionView::Base.full_sanitizer.sanitize(html_string)
|
|
end
|
|
|
|
def model
|
|
raise "This method must be implemented in class #{self.class.name}"
|
|
end
|
|
|
|
def json_values(record)
|
|
raise "This method must be implemented in class #{self.class.name}"
|
|
end
|
|
end
|