class Serf::Handler::Task

Attributes

description[RW]
name[RW]
order[RW]
task[RW]
type[RW]

Public Class Methods

new(type = :query, name = nil, order = 0, description = '', &task) click to toggle source
# File lib/serf/handler/task.rb, line 8
def initialize(type = :query, name = nil, order = 0, description = '', &task)
  @order = order
  @type = type
  @name = name
  @description = description
  @task = task
end

Public Instance Methods

<=>(another_task) click to toggle source
# File lib/serf/handler/task.rb, line 16
def <=>(another_task)
  if @order < another_task.order
    -1
  elsif @order > another_task.order
    1
  else
    if @task.to_s < another_task.task.to_s
      -1
    elsif @task.to_s > another_task.task.to_s
      1
    else
      0
    end
  end
end
call(*args) click to toggle source
# File lib/serf/handler/task.rb, line 32
def call(*args)
  @task.call(*args) if @task
end