Module: Mvmv::Command
- Defined in:
- lib/mvmv/command.rb
Defined Under Namespace
Classes: Sequencer
Class Method Summary collapse
- .ext(x, files) ⇒ Object
- .lower(files) ⇒ Object
- .name(n, files) ⇒ Object
- .name_regexp(f, t, files) ⇒ Object
- .name_regexpi(f, t, files) ⇒ Object
- .name_suffix(s, files) ⇒ Object
- .prefix(p, files) ⇒ Object
- .regexp(f, t, files) ⇒ Object
- .regexpi(f, t, files) ⇒ Object
- .suffix(s, files) ⇒ Object
- .upper(files) ⇒ Object
Class Method Details
.ext(x, files) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/mvmv/command.rb', line 40 def ext x, files files.map { |file| ext = File.extname(file) file.chomp(ext) + x } end |
.lower(files) ⇒ Object
51 52 53 |
# File 'lib/mvmv/command.rb', line 51 def lower files files.map(&:downcase) end |
.name(n, files) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/mvmv/command.rb', line 15 def name n, files seq = Sequencer.new files.map { |file| seq.convert(n) + File.extname(file) } end |
.name_regexp(f, t, files) ⇒ Object
75 76 77 78 79 |
# File 'lib/mvmv/command.rb', line 75 def name_regexp f, t, files regexp(f, t, files.map { |file| file.chomp(File.extname file) }).zip(files.map { |file| File.extname file }).map(&:join) end |
.name_regexpi(f, t, files) ⇒ Object
69 70 71 72 73 |
# File 'lib/mvmv/command.rb', line 69 def name_regexpi f, t, files regexpi(f, t, files.map { |file| file.chomp(File.extname file) }).zip(files.map { |file| File.extname file }).map(&:join) end |
.name_suffix(s, files) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/mvmv/command.rb', line 32 def name_suffix s, files seq = Sequencer.new files.map { |file| ext = File.extname(file) file.chomp(ext) + seq.convert(s) + ext } end |
.prefix(p, files) ⇒ Object
22 23 24 25 |
# File 'lib/mvmv/command.rb', line 22 def prefix p, files seq = Sequencer.new files.map { |file| seq.convert(p) + file } end |
.regexp(f, t, files) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/mvmv/command.rb', line 62 def regexp f, t, files seq = Sequencer.new files.map { |file| seq.convert file.gsub(Regexp.compile(f), t) } end |
.regexpi(f, t, files) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/mvmv/command.rb', line 55 def regexpi f, t, files seq = Sequencer.new files.map { |file| seq.convert file.gsub(Regexp.compile(f, Regexp::IGNORECASE), t) } end |
.suffix(s, files) ⇒ Object
27 28 29 30 |
# File 'lib/mvmv/command.rb', line 27 def suffix s, files seq = Sequencer.new files.map { |file| file + seq.convert(s) } end |
.upper(files) ⇒ Object
47 48 49 |
# File 'lib/mvmv/command.rb', line 47 def upper files files.map(&:upcase) end |