Flowdock
method

index_with

Importance_1
v6.0.0 - Show latest stable - 0 notes - Class: Enumerable
index_with(default = INDEX_WITH_DEFAULT) public

Convert an enumerable to a hash keying it with the enumerable items and with the values returned in the block.

post = Post.new(title: "hey there", body: "what's up?")

%i( title body ).index_with { |attr_name| post.public_send(attr_name) }
# => { title: "hey there", body: "what's up?" }
Show source
Register or log in to add new notes.