What's a nice clean way to use an options hash with defaults values as a parameter in ruby

后端 未结 5 962
轻奢々
轻奢々 2021-02-04 16:32

Let\'s say I want a method which will be called like this:

 tiger = create_tiger( :num_stripes => 12, :max_speed => 43.2 )
 tiger.num_stripes # will be 12
         


        
5条回答
提交回复
热议问题