Class: Datafile::FileDatasetRegistry

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging
Defined in:
lib/datafile/workers/file/registry.rb

Instance Method Summary collapse

Constructor Details

#initializeFileDatasetRegistry

Returns a new instance of FileDatasetRegistry.



11
12
13
14
15
16
17
18
19
20
# File 'lib/datafile/workers/file/registry.rb', line 11

def initialize
  ## org rootpaths
  @roots = {}
  ## org defaults (use merge to overwrite for now)
  @roots[:openmundi]    = '../../openmundi'   ## OPENMUNDI_ROOT    = "../../openmundi"
  @roots[:openfootball] = '..'                ## OPENFOOTBALL_ROOT = ".."
  @roots[:openbeer]     = '..'

  @roots[:footballcsv]  = '..'
end

Instance Method Details

#lookup(name) ⇒ Object



28
29
30
31
# File 'lib/datafile/workers/file/registry.rb', line 28

def lookup( name )
  path, _ = lookup_path( name )    ## note: ignore error message passed along in return
  path
end

#lookup!(name) ⇒ Object



33
34
35
36
37
# File 'lib/datafile/workers/file/registry.rb', line 33

def lookup!( name )
  path, error = lookup_path( name )
  raise error  if error
  path
end

#merge(hash) ⇒ Object



22
23
24
25
26
# File 'lib/datafile/workers/file/registry.rb', line 22

def merge( hash )
  ## todo: add support for merging project mappings too
  ##   use merge_roots and merge_projects ?? why, why not??
  @roots = @roots.merge( hash )
end