Class: Renamr::PointAction

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

Overview

All points besides extention are replaced by minus.

Instance Method Summary collapse

Methods inherited from Action

#p2m, #set

Constructor Details

#initialize(dir) ⇒ PointAction

Returns a new instance of PointAction.



11
12
13
14
15
# File 'lib/renamr/point.rb', line 11

def initialize(dir)
  raise 'dir cannot be nil.' if dir.nil?

  @dir = dir
end

Instance Method Details

#do(src) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/renamr/point.rb', line 17

def do(src)
  if File.file?(File.join(@dir, src))
    p2m(File.basename(src, '.*')) << File.extname(src)
  else
    p2m(src)
  end
end