Created
November 14, 2018 09:59
-
-
Save wojkos/85c383af1f454a78677a06dcdb094418 to your computer and use it in GitHub Desktop.
FarawayDistortedUsernames-1 created by wojkos - https://repl.it/@wojkos/FarawayDistortedUsernames-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text = {:user=>{:first_name=>["must be filled"], :email_address=>["Wrong email format"], :phone_number=>["Wrong phone number format. Use only digits with + on begining"], :address_attributes=>{:street=>["must be filled"], :city=>["must be filled"], :zip_code=>["Wrong zip code format. Use 00-000 format insted"], :country=>["Is not a correct country name"]}, :company_attributes=>{:address_attributes=>{:zip_code=>["Wrong zip code format. Use 00-000 format insted"], :country=>["Is not a correct country name"]}}}} | |
# def parse v | |
# if v.is_a?(Hash) | |
# v.each do |k, v| | |
# parse v | |
# p "#{k v}" | |
# end | |
# else | |
# v | |
# end | |
# end | |
def parse(k, v) | |
unless v.is_a?(Hash) | |
p "#{k} -> #{v}" | |
else | |
p k | |
p "-----" | |
v.each do |k, v| | |
parse(k, v) | |
end | |
end | |
end | |
text.each { |k, v| parse(k,v) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding comment