Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Ruby gem for randomly generating object-oriented class names
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
test
.gitignore
LICENSE.txt
README.rdoc
classnamer.gemspec

README.rdoc

Classnamer

Classnamer randomly generates tongue-in-cheek class names suitable for enterprise-friendly object-oriented programming languages like C++ and Java. It includes a library and a command-line program.

This code is packaged as a RubyGem and tested on the following branches of MRI (Matz's Ruby Interpreter): 1.8.7, 1.9.3, 2.0.0, 2.1.x, and 2.2.x.

Using the command-line program

$ classnamer
PrioritizedUploadWrapper

Using in Ruby code

You can generate a random class name like this:

require 'classnamer'
puts Classnamer.generate # => PrioritizedUploadWrapper

You can customize how class names are generated. Classnamer will generate random class names by concatenating randomly-selected elements of arrays that you provide.

puts Classnamer.generate([%w{Foo Bar}, %w{Baz Qux}]) # => FooQux

You can also specify a custom random number generator. Maybe you don't even want it to be random.

puts Classnamer.generate([%w{Foo Bar}, %w{Baz Qux}], lambda { |_| 0 })
  # => FooBaz

If you plan to use the same customizations multiple times, you can create a Classnamer::Generator object for that.

generator = Classnamer::Generator.new([%w{Foo Bar}, %w{Baz Qux}])
generator.generate # => FooQux
generator.generate # => BarQux

Homepage

Classnamer

Author

This was written by Aaron Beckerman, who you can email at aaron@aaronbeckerman.com.

Acknowledgements

Thanks to Luiz Signorelli and Marta Paciorkowska for their suggestions.

Copyright

This code is distributed under the MIT License (also known as the Expat License). See the LICENSE.txt file for details.

Something went wrong with that request. Please try again.