lib/review/makerhelper.rb in review-5.3.0 vs lib/review/makerhelper.rb in review-5.4.0
- old
+ new
@@ -9,11 +9,11 @@
require 'fileutils'
require 'yaml'
begin
require 'cgi/escape'
-rescue
+rescue StandardError
require 'cgi/util'
end
module ReVIEW
module MakerHelper
@@ -41,19 +41,19 @@
def copy_images_to_dir(from_dir, to_dir, options = {})
image_files = []
Dir.open(from_dir) do |dir|
dir.each do |fname|
- next if fname =~ /^\./
+ next if /^\./.match?(fname)
if FileTest.directory?("#{from_dir}/#{fname}")
image_files += copy_images_to_dir("#{from_dir}/#{fname}", "#{to_dir}/#{fname}", options)
else
FileUtils.mkdir_p(to_dir) unless File.exist?(to_dir)
is_converted = false
(options[:convert] || {}).each do |orig_type, conv_type|
- next unless /\.#{orig_type}$/ =~ fname
+ next unless /\.#{orig_type}$/.match?(fname)
is_converted = system("convert #{from_dir}/#{fname} #{to_dir}/#{fname}.#{conv_type}")
image_files << "#{from_dir}/#{fname}.#{conv_type}"
end