lib/anyway/ext/string_serialize.rb in anyway_config-1.4.4 vs lib/anyway/ext/string_serialize.rb in anyway_config-2.0.0.pre
- old
+ new
@@ -8,18 +8,14 @@
# Array value is a values that contains at least one comma
# and doesn't start/end with quote
ARRAY_RXP = /\A[^'"].*\s*,\s*.*[^'"]\z/
refine ::String do
- # rubocop:disable Metrics/MethodLength
- # rubocop:disable Metrics/CyclomaticComplexity
def serialize
case self
when ARRAY_RXP
- # rubocop:disable Style/SymbolProc
split(/\s*,\s*/).map { |word| word.serialize }
- # rubocop:enable Style/SymbolProc
when /\A(true|t|yes|y)\z/i
true
when /\A(false|f|no|n)\z/i
false
when /\A(nil|null)\z/i
@@ -27,16 +23,14 @@
when /\A\d+\z/
to_i
when /\A\d*\.\d+\z/
to_f
when /\A['"].*['"]\z/
- gsub(/(\A['"]|['"]\z)/, '')
+ gsub(/(\A['"]|['"]\z)/, "")
else
self
end
end
- # rubocop:enable Metrics/MethodLength
- # rubocop:enable Metrics/CyclomaticComplexity
end
using self
end
end