Class: Quby::LookupTableRepo::Disk

Inherits:
Object
  • Object
show all
Defined in:
lib/quby/lookup_table_repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(disk_table_root) ⇒ Disk

Returns a new instance of Disk.



13
14
15
# File 'lib/quby/lookup_table_repo.rb', line 13

def initialize(disk_table_root)
  @disk_table_root = Pathname.new(disk_table_root)
end

Instance Attribute Details

#disk_table_rootObject (readonly)

Returns the value of attribute disk_table_root.



11
12
13
# File 'lib/quby/lookup_table_repo.rb', line 11

def disk_table_root
  @disk_table_root
end

Instance Method Details

#retrieve(key) ⇒ Object



17
18
19
20
21
# File 'lib/quby/lookup_table_repo.rb', line 17

def retrieve(key)
  Quby::LookupTableRepo.validate_key(key)
  path = disk_table_root.join(key + '.csv')
  CSV.read(path, col_sep: ';', skip_blanks: true)
end