Class: Renamr::PrependDateAction
- Defined in:
- lib/renamr/prepend_date.rb
Overview
Prepends file modification datestamp.
Instance Method Summary collapse
- #do(src) ⇒ Object
-
#initialize(dir) ⇒ PrependDateAction
constructor
A new instance of PrependDateAction.
- #set(src) ⇒ Object
Methods inherited from Action
Constructor Details
#initialize(dir) ⇒ PrependDateAction
Returns a new instance of PrependDateAction.
12 13 14 15 |
# File 'lib/renamr/prepend_date.rb', line 12 def initialize(dir) super @dir = dir end |
Instance Method Details
#do(src) ⇒ Object
17 18 19 |
# File 'lib/renamr/prepend_date.rb', line 17 def do(src) src.prepend(File.mtime(File.join(@dir, @src)).strftime('%Y%m%d-')) end |
#set(src) ⇒ Object
21 22 23 |
# File 'lib/renamr/prepend_date.rb', line 21 def set(src) @src = src end |