Class: ODDB::FiPDF::SubstanceIndex

Inherits:
Hash show all
Defined in:
ext/fipdf/src/substance_index.rb

Instance Method Summary (collapse)

Methods inherited from Hash

#obj_path

Instance Method Details

- (Object) sort



13
14
15
16
17
18
19
20
21
# File 'ext/fipdf/src/substance_index.rb', line 13

def sort
  arr = sort_by { |key, element|
    ODDB.search_term(key).downcase
  }
  arr.each { |key, element| 
    element.sort! 
  }
  arr
end

- (Object) store(key, value)



7
8
9
10
11
12
# File 'ext/fipdf/src/substance_index.rb', line 7

def store(key, value)
  value.collect! { |val|
    val.to_s
  }
  (self[key] ||= []).push(value)
end