class ImproveTypography::Processors::SingleQuotes

Public Instance Methods

call() click to toggle source
# File lib/improve_typography/processors/single_quotes.rb, line 4
def call
  return str unless str.match?(/[\'#{single_quotes[0]}#{single_quotes[1]}]/)
  replace_single_quotes
end

Private Instance Methods

regexp() click to toggle source
# File lib/improve_typography/processors/single_quotes.rb, line 15
def regexp
  @regexp ||= Regexp.new("['#{single_quotes[0]}#{single_quotes[1]}](.*?)['#{single_quotes[0]}#{single_quotes[1]}](?!\\w)")
end
replace_single_quotes() click to toggle source
# File lib/improve_typography/processors/single_quotes.rb, line 11
def replace_single_quotes
  str.gsub(regexp, "#{single_quotes[0]}\\1#{single_quotes[1]}")
end
single_quotes() click to toggle source
# File lib/improve_typography/processors/single_quotes.rb, line 19
def single_quotes
  options.fetch(:single_quotes, I18n.t(:single_quotes, scope: %i(improve_typography), locale: locale))
end