Module: DataPaths
- Includes:
- Methods
- Defined in:
- lib/data_paths/finders.rb,
lib/data_paths/methods.rb,
lib/data_paths/version.rb,
lib/data_paths/data_paths.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
data_paths version
'0.3.1'
Class Method Summary collapse
- .included(base) ⇒ Object
-
.paths ⇒ Array<String>
The registered
data/
directories. -
.register(path) ⇒ String
Registers a
data/
directory. -
.unregister(path) ⇒ String
Unregisters a previously registered
data/
directory.
Methods included from Methods
#data_paths, #register_data_dir, #register_data_path, #unregister_data_dir!, #unregister_data_dirs!, #unregister_data_path, #unregister_data_paths
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/data_paths/data_paths.rb', line 6 def self.included(base) base.extend Methods end |
.paths ⇒ Array<String>
The registered data/
directories.
16 17 18 |
# File 'lib/data_paths/data_paths.rb', line 16 def DataPaths.paths @data_paths ||= [] end |
.register(path) ⇒ String
Registers a data/
directory.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/data_paths/data_paths.rb', line 31 def DataPaths.register(path) path = File.(path) unless File.directory?(path) raise("#{path.dump} must be a directory") end paths << path unless paths.include?(path) return path end |
.unregister(path) ⇒ String
Unregisters a previously registered data/
directory.
50 51 52 |
# File 'lib/data_paths/data_paths.rb', line 50 def DataPaths.unregister(path) paths.delete(File.(path)) end |