Skip to content

Allows to type design your text with the help of the mdash.ru's API (Russian language)

License

Notifications You must be signed in to change notification settings

adancedwin/typograph-apiclient-ru

Repository files navigation

Build Status Gem Version

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>Текст&nbsp;&mdash; зафиксированная на&nbsp;носителе человеческая мысль.</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!

About

Allows to type design your text with the help of the mdash.ru's API (Russian language)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages