Ruby on Rails Friday, September 27, 2013




Can someone explain what the "*" operator inside the hash is doing here or what that notation is referred to in this context ? thanks

 

irb(main):006:0* mail_config

=> {"server_setings"=>{"address"=>"smpt-int.ex1.com", "port"=>25}}

 

  irb(main):019:0> Hash[*mail_config['server_setings'].map { |k, v| [k.to_sym, v.t

o_s] }.flatten]

=> {:address=>"smpt-int.ex1.com", :port=>"25"}


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0ae0262b-4836-49ee-a5d8-86a3490cbbe1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment