Let's turn our attention to some newer Ruby syntax.
Are you familiar with the syntax shown in this parameter list?
def initialize(file, permissions:)
end
The syntax shown is for required keyword arguments.
Here's an example:
def foo(bar:)
puts bar
end
foo # => ArgumentError: missing keyword: bar
foo(bar: 'baz') # => 'baz'
Guess which robotically-themed company wrote a handy post about Ruby 2's Keyword Arguments?
Return to Flashcard Results