Format strings dynamically in ruby

2014-03-16

#TIL you can format strings dynamically and neatly with:

puts "%s is at %s" % [
  'John',
  'Singapore'
]

=> John is at Singapore

2021 Update

The above is similar to how we do it in go

person := "John"
country := "Singapore"
fmt.Printf("%s is at %s", person, country)

References:

I’m currently working on fyra.sh, a CLI-first static site deployment tool where you push your site and it’s served globally through a built-in CDN, without the overhead of heavy platforms.