Hash maps/ string formatting and % {}...Help!

Hey guys, Iam a newbie going through basic Ruby code… and Ive come completley unstuck on an excercise, I cant find anywhere that explains how this bit of code works and just the general concept of %{}…Can some please help and explain it real slow to a novice ??

formatter = “%{first} %{second} %{third} %{forth}” # How does this line organise the puts lines below??? i.e what

puts formatter % {first: 1, second: 2, third: 3, forth: 4}
puts formatter % {first: “one” , second: “two”, third: “three”, forth: “four”}
puts formatter % {first: true, second: false, third: true, forth: false}
puts formatter % {first: formatter, second: formatter, third: formatter, forth: formatter}

puts formatter % {
first: “I had this thing.”,
second: “That you could type up right.”,
third: " But it didn’t sing.",
forth: “So I said goodnight.”
}

Is first used as a method, in the code above ?