Module: DK::TQueue

Included in:
Client
Defined in:
lib/draftking/queue.rb

Overview

—————————– Queue Methods —————————– #

Instance Method Summary collapse

Instance Method Details

#move_to_drafts(options) ⇒ Int

Move from Queue to Drafts

Parameters:

  • options (:key_text)
    String

    Move posts not containing :key_text

Returns:

  • (Int)

    Number of modified posts



7
8
9
10
11
12
13
14
15
16
# File 'lib/draftking/queue.rb', line 7

def move_to_drafts(options)
  options[:message] = 'Moving Queue ~> Drafts: '
  options[:shuffle] = false
  options[:state]   = DK::DRAFT
  options[:source] ||= DK::QUEUE
  post_operation(options) do |post, _|
    post.changed = !post.has_key_text?(@key_text)
    post.change_state(@state) if post.changed
  end
end