Class: ImproveTypography::Processors::EmDash

Inherits:
ImproveTypography::Processor show all
Defined in:
lib/improve_typography/processors/em_dash.rb

Constant Summary collapse

REGEXP =
/(\w+?)\s+-{1,3}\s+(\w+?)/i

Instance Attribute Summary

Attributes inherited from ImproveTypography::Processor

#options, #str

Instance Method Summary collapse

Methods inherited from ImproveTypography::Processor

call, inherited, #initialize

Constructor Details

This class inherits a constructor from ImproveTypography::Processor

Instance Method Details

#callObject



6
7
8
9
10
# File 'lib/improve_typography/processors/em_dash.rb', line 6

def call
  return str unless sign_exists?(em_dash_sign)
  return str unless str.match?(/-{1,3}/)
  str.gsub(REGEXP, '\1'+em_dash_sign+'\2')
end