class Array def method_missing(method, *args, &block) if key_value = dynamic_mapper?(method) map_dynamically(key_value[1], key_value[2]) else super end end def dynamic_mapper?(method) /^map_([_a-zA-Z]\w*)_to_([_a-zA-Z]\w*)$/.match(method.to_s) end def map_dynamically(key, value) inject({}) do |result, hash| result.update(hash[key] => hash[value]) end end end project_hashes = [{'name' => 'suspenders', 'color' => 'green'}, {'name' => 'shoulda', 'color' => 'green'}] puts project_hashes.map_name_to_color.inspect