scripts/reference.rb in ffaker-2.11.0 vs scripts/reference.rb in ffaker-2.12.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
$LOAD_PATH << File.dirname(__FILE__) + '/../lib'
require 'ffaker'
ICONS = {
error: '‼️',
@@ -13,10 +15,11 @@
next unless mod.is_a?(Module)
next if mod == FFaker::ArrayUtils
next if mod == FFaker::ModuleUtils
next if mod == FFaker::RandomUtils
next if mod == FFaker::Random
+
mod
end.compact
end
# Returns faker methods for a given module
@@ -57,11 +60,11 @@
arity = mod.method(meth).arity
left = "`#{meth}`"
right = ''
- if arity > 0
+ if arity.positive?
left = "`#{meth}`(#{Array.new(arity) { '...' }.join(', ')})"
else
begin
examples, warnings = catch_warnings do
Array.new(3) { mod.send meth }
@@ -69,10 +72,10 @@
right = if warnings.any?
"#{ICONS[:warning]} *#{warnings.first}*"
else
(escape examples.join(', ')).to_s
end
- rescue => e
+ rescue StandardError => e
right = "#{ICONS[:error]} #{e.class}: #{e.message}"
end
end
lines << "| #{left} | #{right} |"