Module: Kiba::Extend::Destinations::Destinationable
- Defined in:
- lib/kiba/extend/destinations/destinationable.rb
Overview
Mix-in module for extending destinations so they can be set up in jobs
Class Method Summary collapse
-
.as_source_class ⇒ Object
-
.included(base) ⇒ Object
-
.is_destination? ⇒ Boolean
True.
-
.special_options ⇒ Object
Array of defined special options for class.
Instance Method Summary collapse
Class Method Details
.as_source_class ⇒ Object
23 24 25 26 |
# File 'lib/kiba/extend/destinations/destinationable.rb', line 23 def self.as_source_class raise NotImplementedError, ":as_source_class must be defined in extending class" end |
.included(base) ⇒ Object
14 15 16 |
# File 'lib/kiba/extend/destinations/destinationable.rb', line 14 def self.included(base) base.extend(Kiba::Extend::Registry::Fileable) end |
.is_destination? ⇒ Boolean
Returns true.
29 |
# File 'lib/kiba/extend/destinations/destinationable.rb', line 29 def self.is_destination? = true |
.special_options ⇒ Object
Returns Array of defined special options for class.
32 33 34 35 |
# File 'lib/kiba/extend/destinations/destinationable.rb', line 32 def self. raise NotImplementedError, ":special_options must be defined in extending class" end |
Instance Method Details
#ensure_dir ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/kiba/extend/destinations/destinationable.rb', line 37 def ensure_dir return unless self.class.requires_path? dir = Pathname.new(send(self.class.path_key)).dirname return if Dir.exist?(dir) FileUtils.mkdir_p(dir) end |