Module: Kiba::Extend::Registry::Fileable
- Included in:
- Destinations::Destinationable, Sources::Sourceable
- Defined in:
- lib/kiba/extend/registry/fileable.rb
Overview
Mix-in module with shared methods for sources and destinations
Instance Method Summary collapse
-
#default_args(path = nil) ⇒ Object
-
#default_file_options ⇒ Object
abstract
-
#labeled_options ⇒ Object
Hash of file options.
-
#options_key ⇒ Object
abstract
-
#path_key ⇒ Object
abstract
-
#requires_path? ⇒ Boolean
abstract
Boolean whether path to file must be provided.
Instance Method Details
#default_args(path = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/kiba/extend/registry/fileable.rb', line 11 def default_args(path = nil) if requires_path? && path.nil? fail Kiba::Extend::PathRequiredError.new(self) elsif path.nil? else {path_key => path}.merge() end end |
#default_file_options ⇒ Object
This method is abstract.
24 25 26 27 |
# File 'lib/kiba/extend/registry/fileable.rb', line 24 def raise NotImplementedError, ":default_file_options must be defined in extending class" end |
#labeled_options ⇒ Object
Returns Hash of file options.
30 31 32 33 34 35 36 |
# File 'lib/kiba/extend/registry/fileable.rb', line 30 def if && { => } else {} end end |
#options_key ⇒ Object
This method is abstract.
42 43 44 45 |
# File 'lib/kiba/extend/registry/fileable.rb', line 42 def raise NotImplementedError, ":options_key must be defined in extending class" end |
#path_key ⇒ Object
This method is abstract.
51 52 53 54 |
# File 'lib/kiba/extend/registry/fileable.rb', line 51 def path_key raise NotImplementedError, ":path_key must be defined in extending class" end |
#requires_path? ⇒ Boolean
This method is abstract.
Returns Boolean whether path to file must be provided.
58 59 60 61 |
# File 'lib/kiba/extend/registry/fileable.rb', line 58 def requires_path? raise NotImplementedError, ":requires_path? must be defined in extending class" end |