Method: Doing::WWID#archive
- Defined in:
- lib/doing/wwid/modify.rb
#archive(section = Doing.setting('current_section'), options) ⇒ Object
Move entries from a section to Archive or other specified section
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/doing/wwid/modify.rb', line 417 def archive(section = Doing.setting('current_section'), ) ||= {} count = [:keep] || 0 destination = [:destination] || 'Archive' = [:tags] || [] bool = [:bool] || :and section = choose_section if section.nil? || section =~ /choose/i archive_all = section =~ /^all$/i # && !(tags.nil? || tags.empty?) section = guess_section(section) unless archive_all @content.add_section(destination, log: true) # add_section(Section.new('Archive')) if destination =~ /^archive$/i && [email protected]?('Archive') destination = guess_section(destination) if @content.section?(destination) && (@content.section?(section) || archive_all) do_archive(section, destination, { count: count, tags: , bool: bool, search: [:search], label: [:label], before: [:before], after: [:after], from: [:from] }) write(doing_file) else raise InvalidArgument, 'Either source or destination does not exist' end end |