class ImproveTypography::Processors::Apostrophe

Constants

REGEXP

Public Instance Methods

call() click to toggle source
# File lib/improve_typography/processors/apostrophe.rb, line 6
def call
  return str unless str.match?(/'/)
  replace_apostrophe
end

Private Instance Methods

apostrophe_sign() click to toggle source
# File lib/improve_typography/processors/apostrophe.rb, line 17
def apostrophe_sign
  options.fetch(:apostrophe_sign, I18n.t(:apostrophe_sign, scope: %i(improve_typography), locale: locale))
end
replace_apostrophe() click to toggle source
# File lib/improve_typography/processors/apostrophe.rb, line 13
def replace_apostrophe
  str.gsub(REGEXP, "\\1#{apostrophe_sign}\\2")
end