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.
11 12 13 |
# File 'lib/renamr/prepend_date.rb', line 11 def initialize(dir) @dir = dir end |
Instance Method Details
#do(src) ⇒ Object
15 16 17 |
# File 'lib/renamr/prepend_date.rb', line 15 def do(src) src.prepend(File.mtime(File.join(@dir, @src)).strftime('%Y%m%d-')) end |
#set(src) ⇒ Object
19 20 21 |
# File 'lib/renamr/prepend_date.rb', line 19 def set(src) @src = src end |