gem for eliminating local variables from your ruby code
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.document
.gitignore
Gemfile
LICENSE
README.rdoc
Rakefile
VERSION

README.rdoc

localone

Local One adds Object#with and Kernel.let to help you use fewer local variables.

Wha?

%w{ doug bob }.with do |a|
  assert_equal "doug and bob", a.join(' and ')
end

assert_equal 'abcdef', let(:a=>'abc', :b=>'def'){ [a, b].join }

Why is that better than assigning the variables?

Discourages redefining variables leading to a more functional style, looks kind of cool.

What does Local One mean?

Local because it deals with local variables (like you would deal with a rat problem).

Local One because www.flickr.com/photos/phirleh/3873243860/

Does it work on my version of Ruby?

It has been tested on 1.8.6, 1.8.7, and 1.9.1 successfully. I'm having jruby + rvm problems right now, so not sure there. Can't get jeweler or bundler installed on macruby + jvm. Verdict: probably :)

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2010 Bryce Kerley. See LICENSE for details.