Class: Renamr::CharAction

Inherits:
Action
  • Object
show all
Defined in:
lib/renamr/char.rb

Overview

Replaces special symbols with hyphens, except ., &, and $.

Constant Summary collapse

SYM =
' (){},~–\'![]_#@=„“”"`—+‘’;·‡«»%…'.chars.to_set.freeze

Instance Method Summary collapse

Methods inherited from Action

#p2m, #set

Instance Method Details

#do(src) ⇒ Object



14
15
16
# File 'lib/renamr/char.rb', line 14

def do(src)
  src.chars.map { |s| SYM.include?(s) ? '-' : s }.join
end