class String
Public Instance Methods
to_human()
click to toggle source
take a CamelCase or under_scored string and convert it to a human readable string (useful for output).
# File lib/core_refinements/String/to_human.rb, line 6 def to_human return self.split("_").map {|word| word[0] + word[1..-1]}.join(" ") if self.include?("_") return self.split(/(?=[A-Z])/).join(" ").downcase end