Sha256: f983b7d786d298591faf3e42ab6d509a85bd3acb6725a9b6f7956f8f698fc9e1

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

= lazy_const

A simple way of defining lazy evaluated, const-like instances of a class.

== Installation

  gem 'lazy_const'

== Example

  class Group
    extend LazyConst
    lazy_const :EVERYONE do
      new("Everyone")
    end
    def initialize(name)
      @name = name
      @members = []
    end
    def add_user(user)
      @members << user
    end
  end

  class User; end

  class Registrar
    def new_user(name)
      user = User.new(name)
      Group.EVERYONE.add_user(user)
      user
    end
  end


== Contributing to lazy_const
 
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
* Fork the project.
* Start a feature/bugfix branch.
* Commit and push until you are happy with your contribution.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2013 Ryan Graham. See LICENSE.txt for further details. (TL;DR: MIT license)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lazy_const-0.1.1 README.rdoc