Sha256: 5dbe22c7bccb9ff0b5a3428eb0585277ac1fcd0d2bf645252abee96e0b59ec4a

Contents?: true

Size: 796 Bytes

Versions: 2

Compression:

Stored size: 796 Bytes

Contents

require "rus_typograf/version"
require 'rus_typograf/dash'
require 'rus_typograf/punctuation_mark'
require 'rus_typograf/space'
require 'rus_typograf/quotes'

class Typograf
	DEFAULT_GENERATE_OPTIONS = {
		punctuation_mark: true,
		space: true,
		quotes: true,
		dash: true
	}

	def initialize(options={})
		@options = DEFAULT_GENERATE_OPTIONS.merge(options)
	end

	def typograf_text(text)
		@text = text
		if @options[:punctuation_mark]
			punctuation = PunctuationMark.new
			@text = punctuation.replace_dots(@text)
			@text = punctuation.replace_spaces(@text)
			@text = punctuation.add_comma(@text)
		end

		if @options[:dash]
			dash = Dash.new
			@text = dash.replace_dash(@text)
		end

		if @options[:quotes]
			quotes = Quotes.new 
			@text = quotes.replace_quote(@text)
		end 
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rus_typograf-0.6.1 lib/rus_typograf.rb
rus_typograf-0.6.0 lib/rus_typograf.rb