Class: TxghQueue::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/txgh-queue/status.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Status

Returns a new instance of Status.



23
24
25
# File 'lib/txgh-queue/status.rb', line 23

def initialize(options = {})
  @status = options.fetch(:status)
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



21
22
23
# File 'lib/txgh-queue/status.rb', line 21

def status
  @status
end

Class Method Details

.failObject



12
13
14
# File 'lib/txgh-queue/status.rb', line 12

def fail
  @fail ||= new(status: :fail)
end

.okObject



16
17
18
# File 'lib/txgh-queue/status.rb', line 16

def ok
  @ok ||= new(status: :ok)
end

.retry_with_delayObject



8
9
10
# File 'lib/txgh-queue/status.rb', line 8

def retry_with_delay
  @retry_with_delay ||= new(status: :retry_with_delay)
end

.retry_without_delayObject



4
5
6
# File 'lib/txgh-queue/status.rb', line 4

def retry_without_delay
  @retry ||= new(status: :retry_without_delay)
end

Instance Method Details

#fail?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/txgh-queue/status.rb', line 39

def fail?
  status == :fail
end

#ok?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/txgh-queue/status.rb', line 43

def ok?
  status == :ok
end

#retry?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/txgh-queue/status.rb', line 27

def retry?
  retry_with_delay? || retry_without_delay?
end

#retry_with_delay?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/txgh-queue/status.rb', line 31

def retry_with_delay?
  status == :retry_with_delay
end

#retry_without_delay?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/txgh-queue/status.rb', line 35

def retry_without_delay?
  status == :retry_without_delay
end

#to_sObject



47
48
49
# File 'lib/txgh-queue/status.rb', line 47

def to_s
  status.to_s
end