Klassy

A gem that provides a DSL for dynamically creating classes and their objects.

Warning

This code is still in its infancy, and is under active development. It is not to be trusted for anything important.

Installation

Add this line to your application's Gemfile:

gem 'klassy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install klassy

Usage

Example:

Klassy.klassify do
  first_class(name: "bob") do
    second_class(color: "green", answer: 42) do
      third_class
    end
  end
end

results in:

    #<Klassy::FirstClass:0x007fe25397e5b8 @name="bob", @second_class=[
      #<Klassy::SecondClass:0x007fe25396bd50 @color="green", @answer=42,
      @third_class=[
        #<Klassy::ThirdClass:0x007fe2539690f0>
      ]>
    ]>

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request