Sha256: 0930d5e1ccf18b5009bcbea8b6b698badc0dfcd0096e5a62c09dfd6e513a992a

Contents?: true

Size: 317 Bytes

Versions: 216

Compression:

Stored size: 317 Bytes

Contents

module BookKeeping
  VERSION = 4
end

class Acronym
  def self.abbreviate(phrase)
    [].tap do |letters|
      each_word(phrase) do |word|
        letters << word[0].upcase
      end
    end.join
  end

  def self.each_word(phrase)
    phrase.scan(/[A-Z]+[a-z]*|[a-z]+/) do |word|
      yield word
    end
  end
end

Version data entries

216 entries across 216 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.179 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.178 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.177 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.176 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.175 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.174 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.173 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.172 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.171 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.170 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.169 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.167 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.166 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.165 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.164 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.163 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.162 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.161 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb
trackler-2.2.1.160 tracks/ruby/exercises/acronym/.meta/solutions/acronym.rb