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.0.8.16 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.15 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.14 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.13 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.12 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.11 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.10 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.9 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.8 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.7 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.6 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.5 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.4 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.3 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.2 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.8.1 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.7.0 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.6.44 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.6.43 tracks/ruby/exercises/acronym/example.rb
trackler-2.0.6.42 tracks/ruby/exercises/acronym/example.rb