lib/hanami/utils/inflector.rb in hanami-utils-1.0.0.beta2 vs lib/hanami/utils/inflector.rb in hanami-utils-1.0.0.beta3
- old
+ new
@@ -4,12 +4,10 @@
module Hanami
module Utils
# String inflector
#
# @since 0.4.1
- #
- # rubocop:disable Style/PerlBackrefs
module Inflector # rubocop:disable Metrics/ModuleLength
# Rules for irregular plurals
#
# @since 0.6.0
# @api private
@@ -345,10 +343,11 @@
# @since 0.4.1
#
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/MethodLength
+ # rubocop:disable Style/PerlBackrefs
def self.pluralize(string)
return string if string.nil? || string =~ Utils::Blank::STRING_MATCHER
case string
when plurals
@@ -383,10 +382,11 @@
string
else
string + S
end
end
+ # rubocop:enable Style/PerlBackrefs
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/MethodLength
# Singularize the given string
@@ -400,10 +400,11 @@
#
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/PerceivedComplexity
+ # rubocop:disable Style/PerlBackrefs
def self.singularize(string)
return string if string.nil? || string =~ Utils::Blank::STRING_MATCHER
case string
when singulars
@@ -446,13 +447,13 @@
string
else
string.chop
end
end
+ # rubocop:enable Style/PerlBackrefs
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/PerceivedComplexity
end
- # rubocop:enable Style/PerlBackrefs
end
end