module DK::TDrafts

Draft methods

Public Instance Methods

drafts_to_queue(options = {}) click to toggle source

Move Drafts to Queue @param options [Bool] Give DK credit? @param options [String] HTML or Text Comment @param options [int] Limit number of posts selected @param options [string] Modify only posts containing key_text string @param options [String] Suppress progress indicator @param options [bool] Preserve existing post tags @param options [bool] Preserve existing post comments @param options [bool] Simulation? @return [int] Number of modified posts

# File lib/draftking/drafts.rb, line 33
def drafts_to_queue(options = {})
  options[:message] = 'Moving Drafts -> Queue: '
  options[:shuffle] = true
  options[:state]   = DK::QUEUE
  post_operation(options) do |post, index|
    next false unless index_within_limit?(index, @q_space)
    next false unless post.has_key_text?(@key_text)
    post.replace_comment_with(@comment)
    post.change_state(@state)
    post.generate_tags(keep_tags: @keep_tags,
                       add_tags:  @tags,
                       exclude:   @comment,
                       credit:    @credit) if @auto_tag
  end
end
strip_old_comments(options = {}) click to toggle source

Remove comment tree @param options [int] Limit number of posts selected @param options [bool] Suppress progress indicator? @param options [bool] Simulation? @return [int] Number of modified posts

# File lib/draftking/drafts.rb, line 9
def strip_old_comments(options = {})
  options[:message] = 'Stripping previous comments: '
  post_operation(options) do |post, _|
    post.changed = true
  end
end
strip_tags(options = {}) click to toggle source
# File lib/draftking/drafts.rb, line 16
def strip_tags(options = {})
  options[:message] = 'Stripping previous comments: '
  post_operation(options) do |post, _|
    post.clear_tags
  end
end