class ImproveTypography::Processors::EmDash

Constants

REGEXP

Public Instance Methods

call() click to toggle source
# File lib/improve_typography/processors/em_dash.rb, line 6
def call
  return str unless str.match?(/-{1,3}/)
  str.gsub(REGEXP, '\1'+em_dash_sign+'\2')
end

Private Instance Methods

em_dash_sign() click to toggle source
# File lib/improve_typography/processors/em_dash.rb, line 13
def em_dash_sign
  options.fetch(:em_dash_sign, I18n.t(:em_dash_sign, scope: %i(improve_typography), locale: locale))
end