I saw hash arguments used in some library methods as I\'ve been learning.
E.g.,
list.search(:titles, genre: \'jazz\', duration_less_than: 270)
Since Ruby 2.0 you can use keyword arguments [1][2] as opposed to the single Hash parameter.
def foo(keyword_arg: 'bar')
keyword_arg
end
And here's how it behaves.
> foo
=> "bar"
> foo(keyword_arg: 'baz')
=> "baz"