D
D
Dima2015-05-18 14:50:20
Ruby on Rails
Dima, 2015-05-18 14:50:20

How to make a transfer from one layout to another?

Hello. The task is as follows: you need to translate the text from one layout to another. That is, from куищщеget reboot, and from lfget даIs there a ready-made solution for Ruby/Ruby on Rails?
Or is it better to write a method yourself

def change_lng_mode(str)
    keymap = {a: "ф", b: "и"  ... }
    str.gsub!(/[A-z]/) do |char|
        keymap[char.to_sym]
    end
  end

?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2015-05-18
@MAXOPKA

You can simply
extend the String class with the desired method and that's all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question