Class: EhbrsRubyUtils::Music::Sort::Files::Factory
- Inherits:
-
Object
- Object
- EhbrsRubyUtils::Music::Sort::Files::Factory
- Defined in:
- lib/ehbrs_ruby_utils/music/sort/files/factory.rb
Constant Summary collapse
- SECTION_CURRENT =
'A'
- SECTION_NEW =
'Z'
- SECTIONS =
[SECTION_CURRENT, SECTION_NEW].freeze
- NO_ORDER =
Float::INFINITY
Instance Method Summary collapse
Instance Method Details
#basename ⇒ Object
18 19 20 |
# File 'lib/ehbrs_ruby_utils/music/sort/files/factory.rb', line 18 def basename by_pattern(3).if_present(path.basename.to_path) end |
#build ⇒ Object
22 23 24 |
# File 'lib/ehbrs_ruby_utils/music/sort/files/factory.rb', line 22 def build ::EhbrsRubyUtils::Music::Sort::Files::Base.new(section, order, basename, path) end |
#order ⇒ Object
26 27 28 |
# File 'lib/ehbrs_ruby_utils/music/sort/files/factory.rb', line 26 def order order_from_config_data || by_pattern(2).if_present(NO_ORDER, &:to_i) end |
#section ⇒ Object
30 31 32 33 34 35 |
# File 'lib/ehbrs_ruby_utils/music/sort/files/factory.rb', line 30 def section r = section_from_config_data || by_pattern(1).if_present(SECTION_NEW) return SECTION_CURRENT if r.blank? || r.upcase == SECTION_CURRENT SECTION_NEW end |