Class: Kiba::Extend::Registry::RegisteredLookup
- Inherits:
-
RegisteredFile
- Object
- RegisteredFile
- Kiba::Extend::Registry::RegisteredLookup
- Includes:
- RequirableFile
- Defined in:
- lib/kiba/extend/registry/registered_lookup.rb
Overview
Value object representing a file registered in a FileRegistry that is being called into another job as a lookup table
Assumes this file will be used to build a Lookup
Instance Attribute Summary
Attributes inherited from RegisteredFile
#data, #desc, #dest_class, #dest_opt, #dest_special_opts, #key, #lookup_on, #path, #src_opt, #supplied
Instance Method Summary collapse
-
#args ⇒ Hash
Arguments for calling Lookup with this file.
-
#initialize(key:, data:, for_job:) ⇒ RegisteredLookup
constructor
A new instance of RegisteredLookup.
-
#klass ⇒ Object
Methods included from RequirableFile
Methods inherited from RegisteredFile
Constructor Details
#initialize(key:, data:, for_job:) ⇒ RegisteredLookup
Returns a new instance of RegisteredLookup.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kiba/extend/registry/registered_lookup.rb', line 23 def initialize(key:, data:, for_job:) super unless src_class.respond_to?(:is_lookupable?) fail Kiba::Extend::JobCannotBeUsedAsLookupError.new( key, src_class, for_job ) end unless lookup_on fail Kiba::Extend::NoLookupOnError.new(key, for_job) end unless lookup_on.is_a?(Symbol) fail Kiba::Extend::NonSymbolLookupOnError.new(key, for_job) end end |
Instance Method Details
#args ⇒ Hash
Arguments for calling Lookup with this file
40 41 42 |
# File 'lib/kiba/extend/registry/registered_lookup.rb', line 40 def args {file: path, keycolumn: lookup_on}.merge() end |
#klass ⇒ Object
44 45 46 |
# File 'lib/kiba/extend/registry/registered_lookup.rb', line 44 def klass src_class end |