Class: Mspire::Mzml::IndexList
- Defined in:
- lib/mspire/mzml/index_list.rb
Overview
A simple array of indices but #[] has been overloaded to find an index by name
index_list[0] # the first index
index_list.map(&:names) # -> [:spectrum, :chromatogram]
index_list[:spectrum] # the spectrum index
index_list[:chromatogram] # the chromatogram index
Instance Method Summary collapse
-
#[](int_or_symbol) ⇒ Mspire::Mzml::Index
An index object.
- #old_bracket_slice ⇒ Object
Methods inherited from Array
Instance Method Details
#[](int_or_symbol) ⇒ Mspire::Mzml::Index
Returns an index object.
16 17 18 19 20 21 22 |
# File 'lib/mspire/mzml/index_list.rb', line 16 def [](int_or_symbol) if int_or_symbol.is_a?(Integer) old_bracket_slice(int_or_symbol) else self.find {|index| index.name == int_or_symbol } end end |
#old_bracket_slice ⇒ Object
11 |
# File 'lib/mspire/mzml/index_list.rb', line 11 alias_method :old_bracket_slice, :'[]' |