Module: DataPaths::Methods
- Included in:
- DataPaths
- Defined in:
- lib/data_paths/methods.rb
Instance Method Summary collapse
-
#data_paths ⇒ Array<String>
The directories registered within a specific module or class.
-
#register_data_dir(path) ⇒ Object
deprecated
Deprecated.
Will be removed 1.0.0, please use #register_data_path instead.
-
#register_data_path(path) ⇒ String
Registers a path as a data directory.
-
#unregister_data_dir!(path) ⇒ Object
deprecated
Deprecated.
Will be removed 1.0.0, please use #unregister_data_path instead.
-
#unregister_data_dirs! ⇒ Object
deprecated
Deprecated.
Will be removed 1.0.0, please use #unregister_data_paths instead.
-
#unregister_data_path(path) ⇒ String
Unregisters any matching data directories.
-
#unregister_data_paths ⇒ true
Unregisters all previously registered data directories.
Instance Method Details
#data_paths ⇒ Array<String>
The directories registered within a specific module or class.
9 10 11 |
# File 'lib/data_paths/methods.rb', line 9 def data_paths @data_paths ||= [] end |
#register_data_dir(path) ⇒ Object
Will be removed 1.0.0, please use #register_data_path instead.
43 44 45 46 47 |
# File 'lib/data_paths/methods.rb', line 43 def register_data_dir(path) STDERR.puts "DEPRECATED: Please use register_data_path instead." register_data_path(path) end |
#register_data_path(path) ⇒ String
Registers a path as a data directory.
30 31 32 33 34 35 36 37 |
# File 'lib/data_paths/methods.rb', line 30 def register_data_path(path) path = File.(path) DataPaths.register(path) data_paths << path unless data_paths.include?(path) return path end |
#unregister_data_dir!(path) ⇒ Object
Will be removed 1.0.0, please use #unregister_data_path instead.
71 72 73 74 75 |
# File 'lib/data_paths/methods.rb', line 71 def unregister_data_dir!(path) STDERR.puts "DEPRECATED: Please use unregister_data_path instead." unregister_data_path(path) end |
#unregister_data_dirs! ⇒ Object
Will be removed 1.0.0, please use #unregister_data_paths instead.
95 96 97 98 99 |
# File 'lib/data_paths/methods.rb', line 95 def unregister_data_dirs! STDERR.puts "DEPRECATED: Please use unregister_data_paths instead." unregister_data_paths end |
#unregister_data_path(path) ⇒ String
Unregisters any matching data directories.
60 61 62 63 64 65 |
# File 'lib/data_paths/methods.rb', line 60 def unregister_data_path(path) path = File.(path) self.data_paths.delete(path) return DataPaths.unregister!(path) end |
#unregister_data_paths ⇒ true
Unregisters all previously registered data directories.
85 86 87 88 89 |
# File 'lib/data_paths/methods.rb', line 85 def unregister_data_paths data_paths.each { |path| DataPaths.unregister!(path) } data_paths.clear return true end |