How to start really getting Ruby, especially blocks.
I think I’m really starting to get Ruby. At least I can read Ruby and tell you what’s happening.
I haven’t read a single tutorial on RSpec, the testing framework we use at Chatwoot for the Rails backend. I didn’t want to spend too much time in tutorial hell, and I’m sure that I should read more about it soon.
I’ve written about Ruby blocks before, but I think it bears repeating. This is a method call with a block as an input.
1 2 3 perform "input_value" do puts "I'll get called with that function" end
Don’t worry about how the function is implemented for now. I’m hand-waving this so that you can notice something.
This is also a method call with a block as an input.
1 it ( "can do something" ) { puts "The cake is a lie" }
But here’s something else that’s a method call with a block as an input.
In lib/calculator.rb :
... continue reading