Sha256: fed359c1cc2c544635fdb42c0719d67f9c9cc78040eee26874a4e059eeb33c3c

Contents?: true

Size: 317 Bytes

Versions: 156

Compression:

Stored size: 317 Bytes

Contents

module BookKeeping
  VERSION = 2
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

156 entries across 156 versions & 1 rubygems

Version Path
trackler-2.1.0.1 tracks/ruby/exercises/acronym/example.rb
trackler-2.1.0.0 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.55 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.54 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.53 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.52 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.51 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.50 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.49 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.48 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.47 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.46 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.45 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.44 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.43 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.42 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.41 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.40 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.39 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.38 tracks/ruby/exercises/acronym/example.rb