skip to main
|
skip to sidebar
A Rails Blog
Notes for future ninya (if you're still a programmer)
Thursday, May 6, 2010
Strip blank strings and nil elements from Ruby Array
array_with_blanks_and_nils = ["a", '', nil]
array_with_blanks_and_nils.compact.reject(&:blank?) #=> ["a"]
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
▼
2010
(15)
►
October
(1)
►
September
(1)
►
July
(1)
►
June
(4)
▼
May
(4)
Double Callbacks
Weird submodule story
Strip blank strings and nil elements from Ruby Array
Send Mail with Pony
►
April
(4)
About Me
ninya
an artist constantly imagining stuff to create. available for freelance
View my complete profile
No comments:
Post a Comment