Stefanos Ioannou Tou Andrikkou said
Thanks Jay. Interesting video! Appreciating your effort.
A subscription is required to view this video. Enroll Today
Jay McGavren gives an overview of a few Ruby Core Classes, covering examples from the String, Array, Hash, and Enumerable classes. If the Ruby language still feels new for you, this is definitely worth watching.
Thanks Jay. Interesting video! Appreciating your effort.
Great video! I'd love to see more like these, focused on just Ruby (not rails).
same goes for %S, and there are probably others
%W can use any delimiter you like, not just "/". it could be %W[ ... ], etc
using global methods is not required to use the bang! methods.
string.strip! works just fine
gsub = "global substitute" (replaces globally) sub = "(local) substitute)"
Very helpful. Thanks!
Nicely done! It's always good to be reminded of/introduced to methods like these.
Great screencast! Learned some new tricks that I can apply at work tomorrow. Thanks Jay!!
@mikestok right you are - the += is a little misleading. This would probably have been a better example:
sum = scores.inject(0) {|sum, value| sum + value}
Good catch!
In the explanation of inject using bowling scores in a season it seems redundant to use sum += value at the end of the inject block as the inject will put the return value of the block into the "accumulator", so
sum = scores.inject(0) do |accumulator, score| accumulator + score end
works and might give more insight into how inject works.