Joined June 2013
·
Posted to
Ruby tricks to make your code more fun and less readable
over 1 year
ago
My 2 cents:
ActiveSupport`s String#strip_heredoc
case you
when -> y {y.happy?} then y.clap_hands #stolen from Avdi (?)
when PersonAnalyzer.method :hulk? then y.destroy!
end
- Shameless self-promotion: weekend experiment of mine. which allows something like:
puts mike.tell{"Call me #{name}. First thing you should know - don`t do business with #{cook.name}"}
or
gus = cast.find &which{ surname =~ /esposito/i }
but at the same time - still restricts protected and private methods:
https://github.com/idrozd/red_bikini
Posted to
Ruby `sort_by` Multiple Fields
over 1 year
ago
There is nothing to document here, it`s just a consequence of Array having <=> defined on it )
Achievements
103 Karma
3,656 Total ProTip Views
Mongoose 3
Have at least three original repos where Ruby is the dominant language
Raven
Have at least one original repo where some form of shell script is the dominant language
Walrus
The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos
Charity
Fork and commit to someone's open source project in need
Mongoose
Have at least one original repo where Ruby is the dominant language
Is this still relevant?
I was thinking about having test-transaction-like functionality in development mode;
Like – submit a form, see what happens, and rollback by clicking some button.