Class: QueueIt::Node

Inherits:
ApplicationRecord show all
Defined in:
app/models/queue_it/node.rb

Instance Method Summary collapse

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/queue_it/node.rb', line 36

def any?
  kind == 'any'
end

#head?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/models/queue_it/node.rb', line 28

def head?
  kind == 'head'
end

#only_one_headObject



16
17
18
19
20
# File 'app/models/queue_it/node.rb', line 16

def only_one_head
  if repeated_kind?('head')
    errors.add(:kind, 'There can not be more than 1 head node in each queue')
  end
end

#only_one_tailObject



22
23
24
25
26
# File 'app/models/queue_it/node.rb', line 22

def only_one_tail
  if repeated_kind?('tail')
    errors.add(:kind, 'There can not be more than 1 tail node in each queue')
  end
end

#tail?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/models/queue_it/node.rb', line 32

def tail?
  kind == 'tail'
end