Class: Rjson::DataReverseController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rjson/data_reverse_controller.rb

Instance Method Summary collapse

Instance Method Details

#data_collectObject



5
6
7
8
9
10
# File 'app/controllers/rjson/data_reverse_controller.rb', line 5

def data_collect
  input = {:key1=>"value1", :key2=>"value2", :key3=>"value3", :key4=>"value4", :key5=>"value5"}
  output = Hash[input.map { |k, str| [k, str.reverse] }.to_h]

  puts output
end