typograph-apiclient-ru
Allows to type design your text with the help of the mdash.ru's API (Russian language). Can be installed as a gem:
gem install typograph-apiclient-ru
How to use it
1. Initialize a class and type design your text
require_relative 'typograph'
typograph = Typograph::MdashTypograph.new
p formatted_text = typograph.text("Текст — зафиксированная на носителе человеческая мысль.")
# => "<p>Текст — зафиксированная на носителе человеческая мысль.</p>"
2. Set up your error handling
Warning: in case for any reason API is unavailable - the same text as passed will be returned (i.e. no error raised).
require_relative 'typograph'
typograph = Typograph::MdashTypograph.new
begin
formatted_text = typograph.text(nil)
rescue ArgumentError => e
puts "#{e.message}. Error message rescued!"
end
# => Incorrect argument given - NilClass. Must be String!. Error message rescued!