I redirected ri's ruby Array doc into a file but it didn't look good in gedit. But text looks just fine in cli. That's how my file looks in terminal editors. Everything is fine here.
= 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 = {})
------------------------------------------------------------------------------
But when I open it in gedit or other gnome editors, that's how it looks like. Some specific words look in absurd format. Any suggestions or help will be appreciated.
= 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 = {})
------------------------------------------------------------------------------
ri
outputs documentation formatted as ASCII text, with overstriking
. You can check this by running the file
command on your file.
Some parts of the documentation are bolded, which is represented by some character, backspace (^H
) and the first character again. It seems that gedit and other gnome editors ignore these backspace characters, leaving the actual character repeated.
You can output just the ASCII like this:
ri Array | col -bx > array.txt
An answer with more information about nroff
formatting: https://unix.stackexchange.com/a/274795