J
Jan Lelis
Hi, I've collected some nice little additions to Ruby and put them in a
gem called zucker.
Some of the features:
* control structure like iteration:
iterate [1,2], [3,4,5] do |e,f|
puts "#{e},#{f}"
end
# outputs
# 1,3
# 2,4
# ,5
* Regexp.union shortcut
/Ruby\d/ | /test/i | "cheat"
# creates a Regexp similar to:
# /(Ruby\d|[tT][eE][sS][tT]|cheat)/
* Blocks, where nil can be egocentric
egonil do
nil.some_methods.that[:do].not.exist
end # => nil
* Array#to_proc
[1,2,3].map &[:*, 5] # => [5, 10, 15]
* More at http://rubyzucker.info / http://github.com/janlelis/zucker
What's your opinion about these methods?
J-_-L
gem called zucker.
Some of the features:
* control structure like iteration:
iterate [1,2], [3,4,5] do |e,f|
puts "#{e},#{f}"
end
# outputs
# 1,3
# 2,4
# ,5
* Regexp.union shortcut
/Ruby\d/ | /test/i | "cheat"
# creates a Regexp similar to:
# /(Ruby\d|[tT][eE][sS][tT]|cheat)/
* Blocks, where nil can be egocentric
egonil do
nil.some_methods.that[:do].not.exist
end # => nil
* Array#to_proc
[1,2,3].map &[:*, 5] # => [5, 10, 15]
* More at http://rubyzucker.info / http://github.com/janlelis/zucker
What's your opinion about these methods?
J-_-L