Lynn's Dev Blog
  • About
  • Rails
  • Ruby
  • Experience
Sign in Subscribe

Ruby

A collection of 3 posts
TIL: How to define a multiline string in Ruby
Ruby

TIL: How to define a multiline string in Ruby

Note: The following was tested with Ruby 2.6.6 > Keyword: Heredoc What is heredoc? Heredoc [https://en.wikipedia.org/wiki/Here_document] is used for a form of multiline strings and preserves the line breaks and whitespace (including indentation) in the text. How to define a heredoc in Ruby?
Dec 8, 2021 2 min read
How to Benchmark my code in Ruby or Rails
Ruby

How to Benchmark my code in Ruby or Rails

Recently, I had a job to fix the slow code. Before diving into fixing the slow code, I used Scout APM to identify the performance bottlenecks, which helped me make sure where the slow code is. To prove the new optimization solution is faster, in addition to checking the before-after
Sep 18, 2021 5 min read
Play with nil
Ruby

Play with nil

What's nil? nil is an instance of NilClass. It's a special Ruby object used to represent the absence of any value.  And it also behaves like false when used in a conditional statement. What's more, there is only one nil object, whose object_id is always 8 (in 64-bit Ruby)
Aug 13, 2021 2 min read
Page 1 of 1
Lynn's Dev Blog © 2023
Powered by Ghost