2017-11-12 1 views
0

Ich leitete ri's Ruby Array Doc in eine Datei, aber es sah nicht gut in gedit. Aber Text sieht in cli gut aus. So sieht meine Datei in Terminal-Editoren aus. Alles ist gut hier.Linux Katze und weniger Ausgabe für meine Textdatei ist anders als gedit und andere Gnome-Editor

= Array#to_param 
 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_param() 
 

 
------------------------------------------------------------------------------ 
 

 
Calls to_param on all its elements and joins the result with slashes. This is 
 
used by url_for in Action Pack. 
 

 

 
= Array#to_query 
 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_query(key) 
 

 
------------------------------------------------------------------------------ 
 

 
Converts an array into a string suitable for use as a URL query string, using 
 
the given key as the param name. 
 

 
    ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding" 
 

 

 
= Array#to_s 
 

 
(from ruby core) 
 
------------------------------------------------------------------------------ 
 
    to_s() 
 

 
------------------------------------------------------------------------------ 
 

 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_s(format = :default) 
 

 
------------------------------------------------------------------------------ 
 

 

 
= Array#to_sentence 
 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_sentence(options = {}) 
 

 
------------------------------------------------------------------------------

Aber wenn ich es in gedit oder anderen gnome-Editoren öffnen, das ist, wie es aussieht. Einige spezifische Wörter sehen in absurdem Format aus. Irgendwelche Vorschläge oder Hilfe werden geschätzt.

= AArrrraayy##ttoo__ffoorrmmaatttteedd__ss 
 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_formatted_s(format = :default) 
 

 
------------------------------------------------------------------------------ 
 

 
Extends Array#to_s to convert a collection of elements into a comma separated 
 
id list if :db argument is given as the format. 
 

 
    Blog.all.to_formatted_s(:db) # => "1,2,3" 
 
    Blog.none.to_formatted_s(:db) # => "null" 
 
    [1,2].to_formatted_s   # => "[1, 2]" 
 

 

 
= AArrrraayy##ttoo__ppaarraamm 
 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_param() 
 

 
------------------------------------------------------------------------------ 
 

 
Calls to_param on all its elements and joins the result with slashes. This is 
 
used by url_for in Action Pack. 
 

 

 
= AArrrraayy##ttoo__qquueerryy 
 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_query(key) 
 

 
------------------------------------------------------------------------------ 
 

 
Converts an array into a string suitable for use as a URL query string, using 
 
the given key as the param name. 
 

 
    ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding" 
 

 

 
= AArrrraayy##ttoo__ss 
 

 
(from ruby core) 
 
------------------------------------------------------------------------------ 
 
    to_s() 
 

 
------------------------------------------------------------------------------ 
 

 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_s(format = :default) 
 

 
------------------------------------------------------------------------------ 
 

 

 
= AArrrraayy##ttoo__sseenntteennccee 
 

 
(from gem activesupport-5.1.3) 
 
------------------------------------------------------------------------------ 
 
    to_sentence(options = {}) 
 

 
------------------------------------------------------------------------------
Ich versuchte, es in jedem System zu öffnen. aber Text ist immer noch überall außer Terminal-Editoren wie Katze oder weniger durcheinander. Hat es etwas mit Textcodierung zu tun?

Antwort

0

ri Ausgaben Dokumentation formatiert als ASCII text, with overstriking. Sie können dies überprüfen, indem Sie den Befehl file für Ihre Datei ausführen.

Einige Teile der Dokumentation sind fett geschrieben, was durch ein Zeichen, Backspace (^H) und das erste Zeichen wieder dargestellt wird. Es scheint, dass gedit und andere gnome Editoren diese Rücktaste Zeichen ignorieren, den tatsächlichen Charakter wiederholt.

können Sie die Ausgabe nur die ASCII wie folgt aus: ri Array | col -bx > array.txt

Eine Antwort mit mehr Informationen über nroff Formatierung: https://unix.stackexchange.com/a/274795

+0

Vielen Dank für Ihre Antwort. Es funktionierte!!! Ich habe auch angefangen, in ris Manpage zu schauen und festgestellt, dass man das Ausgabeformat mit der Option -f ändern kann. Also, ri -f rdoc Array> array.txt funktioniert auch. – Meimo

Verwandte Themen