class ImproveTypography::Processors::EnDash

Constants

REGEXP

Public Instance Methods

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

Private Instance Methods

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