Class: Kiba::Extend::Registry::RegisteredDestination

Inherits:
RegisteredFile show all
Defined in:
lib/kiba/extend/registry/registered_destination.rb

Overview

Value object representing a destination file registered in a FileRegistry

Since:

  • 2.2.0

Defined Under Namespace

Classes: SuppliedEntryError

Instance Attribute Summary

Attributes inherited from RegisteredFile

#data, #desc, #dest_class, #dest_opt, #dest_special_opts, #dynamic_source, #key, #lookup_on, #path, #src_opt, #supplied

Instance Method Summary collapse

Methods inherited from RegisteredFile

#src_class

Constructor Details

#initialize(key:, for_job:, data: nil) ⇒ RegisteredDestination

Returns a new instance of RegisteredDestination.

Since:

  • 2.2.0



18
19
20
21
22
23
24
25
26
# File 'lib/kiba/extend/registry/registered_destination.rb', line 18

def initialize(key:, for_job:, data: nil)
  super
  fail SuppliedEntryError.new(key) if supplied
  if dynamic_source
    fail Kiba::Extend::DynamicSourceUseError.new(
      key, self.class.name, for_job
    )
  end
end

Instance Method Details

#argsObject

Arguments for calling Kiba Destination class

Since:

  • 2.2.0



29
30
31
32
33
34
35
36
37
# File 'lib/kiba/extend/registry/registered_destination.rb', line 29

def args
  return simple_args unless dest_special_opts

  opts = supported_special_opts
  warn_about_opts if opts.length < dest_special_opts.length
  return simple_args if opts.empty?

  simple_args.merge(supported_special_opts)
end

#descriptionObject

Description of file

Used in post-processing STDOUT

Since:

  • 2.2.0



42
43
44
# File 'lib/kiba/extend/registry/registered_destination.rb', line 42

def description
  desc
end

#klassObject

Since:

  • 2.2.0



46
47
48
# File 'lib/kiba/extend/registry/registered_destination.rb', line 46

def klass
  dest_class
end