Class: Typograf

Inherits:
Object
  • Object
show all
Defined in:
lib/rus_typograf.rb

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Typograf

Returns a new instance of Typograf.



15
16
17
# File 'lib/rus_typograf.rb', line 15

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

Instance Method Details

#typograf_text(text) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rus_typograf.rb', line 19

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