ruby - acronym

This commit is contained in:
2018-09-21 09:06:59 -04:00
parent 6ccf257fdd
commit 3d38be970c
3 changed files with 82 additions and 0 deletions

9
ruby/acronym/acronym.rb Normal file
View File

@ -0,0 +1,9 @@
class Acronym
def self.abbreviate(long_name)
abbrev = ""
long_name.split(/[\W-]+/).each do |word|
abbrev += word[0]
end
abbrev.upcase
end
end