Module: BlackStack::CSVIndexer

Defined in:
lib/csv-indexer.rb

Defined Under Namespace

Classes: Index

Class Method Summary collapse

Class Method Details

.add_indexation(h) ⇒ Object



12
13
14
# File 'lib/csv-indexer.rb', line 12

def self.add_indexation(h)
    @indexes << BlackStack::CSVIndexer::Index.new(h)
end

.find(name, key, exact_match = true, write_log = false) ⇒ Object



22
23
24
25
26
# File 'lib/csv-indexer.rb', line 22

def self.find(name, key, exact_match=true, write_log=false)
    i = @indexes.select { |i| i.name = name }.first
    raise 'Index not found.' if i.nil?
    i.find(key, exact_match, write_log)
end

.index(name, write_log = true) ⇒ Object



16
17
18
19
20
# File 'lib/csv-indexer.rb', line 16

def self.index(name, write_log=true)
    i = @indexes.select { |i| i.name = name }.first
    raise 'Index not found.' if i.nil?
    i.index(write_log)
end

.indexesObject



8
9
10
# File 'lib/csv-indexer.rb', line 8

def self.indexes
    @indexes
end