Project

localone

0.0
No commit activity in last 3 years
No release in over 3 years
Add Object#with and Kernel.let to your repertoire to crack down on local variables.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

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 © 2010 Bryce Kerley. See LICENSE for details.