Class: Utils

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

Overview

All methods are static.

Constant Summary collapse

SEP =
'~'

Class Method Summary collapse

Class Method Details

.trim(src, lim) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/renamr/utils.rb', line 10

def trim(src, lim)
  return src if src.length <= lim

  beg = fin = (lim - SEP.length) / 2
  beg -= 1 if lim.odd?
  src[0..beg] + SEP + src[-fin..-1]
end