Class: EhbrsRubyUtils::Music::Sort::Files::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ehbrs_ruby_utils/music/sort/files/base.rb

Instance Method Summary collapse

Instance Method Details

#reorder(new_section, new_order, padding) ⇒ Object



14
15
16
# File 'lib/ehbrs_ruby_utils/music/sort/files/base.rb', line 14

def reorder(new_section, new_order, padding)
  self.class.new(new_section, new_order, name, original_path, padding)
end

#source_basenameObject



22
23
24
# File 'lib/ehbrs_ruby_utils/music/sort/files/base.rb', line 22

def source_basename
  original_path.if_present(&:basename) || raise('Original path is blank')
end

#target_basenameObject



18
19
20
# File 'lib/ehbrs_ruby_utils/music/sort/files/base.rb', line 18

def target_basename
  "#{section}#{order.to_s.rjust(padding, '0')} #{name}"
end

#to_sObject



26
27
28
# File 'lib/ehbrs_ruby_utils/music/sort/files/base.rb', line 26

def to_s
  target_basename
end