Class: BioTable::LazyValues
- Inherits:
-
Object
- Object
- BioTable::LazyValues
- Defined in:
- lib/bio-table/filter.rb
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(fields) ⇒ LazyValues
constructor
A new instance of LazyValues.
Constructor Details
#initialize(fields) ⇒ LazyValues
Returns a new instance of LazyValues.
4 5 6 7 |
# File 'lib/bio-table/filter.rb', line 4 def initialize fields @fields = fields @values = [] # cache values end |
Instance Method Details
#[](index) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/bio-table/filter.rb', line 9 def [] index if not @values[index] field = @fields[index] @values[index] = (Filter::valid_number?(field) ? field.to_f : nil ) end @values[index] end |