lib/convenient_service/utils/string/camelize.rb in convenient_service-0.9.0 vs lib/convenient_service/utils/string/camelize.rb in convenient_service-0.10.0
- old
+ new
@@ -11,22 +11,22 @@
# - https://github.com/rails/rails/blob/5aaaa1630ae9a71b3c3ecc4dc46074d678c08d67/activesupport/lib/active_support/inflector/methods.rb#L53
#
class Camelize < Support::Command
##
# @!attribute [r] string
- # @return [#to_s]
+ # @return [String]
#
attr_reader :string
##
# @!attribute [r] capitalize_first_letter
# @return [Boolean]
#
attr_reader :capitalize_first_letter
##
- # @param string [Symbol, String]
+ # @param string [#to_s]
# @return [void]
#
def initialize(string, capitalize_first_letter: true)
@string = string.to_s
@capitalize_first_letter = capitalize_first_letter
@@ -43,9 +43,13 @@
camelized
end
private
+ ##
+ # @param part [String]
+ # @return [String]
+ #
def upcase_first_char(part)
return part if part.empty?
"#{part[0].upcase}#{part[1..]}"
end