Module: Taskinator::Persistence::UnknownType

Defined in:
lib/taskinator/persistence.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



472
473
474
# File 'lib/taskinator/persistence.rb', line 472

def type
  @type
end

Class Method Details

.new(type) ⇒ Object



459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/taskinator/persistence.rb', line 459

def self.new(type)
  Taskinator.logger.error("Unknown type '#{type}' while deserializing.")
  @unknown_types[type] ||= Module.new do
    extend UnknownType
    @type = type

    # for unknown definitions
    def method_missing(_, *_)
      raise UnknownTypeError.new(to_s)
    end
  end
end

Instance Method Details

#accept(*_) ⇒ Object



482
483
484
# File 'lib/taskinator/persistence.rb', line 482

def accept(*_)
  # nothing doing
end

#allocateObject



478
479
480
# File 'lib/taskinator/persistence.rb', line 478

def allocate
  self
end

#perform(*_) ⇒ Object

for unknown job types

Raises:



487
488
489
# File 'lib/taskinator/persistence.rb', line 487

def perform(*_)
  raise UnknownTypeError.new(to_s)
end

#to_sObject



474
475
476
# File 'lib/taskinator/persistence.rb', line 474

def to_s
  "Unknown type '#{type}'."
end