Class: Stat::Record
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Stat::Record
- Defined in:
- lib/stat/record.rb
Overview
Record is a single row in a data table
Instance Method Summary collapse
-
#initialize(fields, line) ⇒ Record
constructor
A new instance of Record.
Constructor Details
#initialize(fields, line) ⇒ Record
Returns a new instance of Record.
8 9 10 11 12 13 14 |
# File 'lib/stat/record.rb', line 8 def initialize fields, line super() fields.each do |(name, start, finish, type)| val = line[start-1...finish].strip.send("to_#{type}") rescue nil send "#{name}=", val end end |