Class: SeisRuby::Data::Cmtsolution::Centroid
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- SeisRuby::Data::Cmtsolution::Centroid
- Defined in:
- lib/seis_ruby/data/cmtsolution.rb
Constant Summary collapse
- FIELDS =
[ # name, converter [:event_name, :strip], [:time_shift, :to_f ], [:half_duration, :to_f ], [:latitude, :to_f ], [:longitude, :to_f ], [:depth, :to_f ], [:mrr, :to_f ], [:mtt, :to_f ], [:mpp, :to_f ], [:mrt, :to_f ], [:mrp, :to_f ], [:mtp, :to_f ], ]
Instance Attribute Summary collapse
-
#table ⇒ Object
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(lines) ⇒ Centroid
constructor
A new instance of Centroid.
Constructor Details
#initialize(lines) ⇒ Centroid
Returns a new instance of Centroid.
88 89 90 91 92 93 94 |
# File 'lib/seis_ruby/data/cmtsolution.rb', line 88 def initialize(lines) h = {} FIELDS.zip(lines){|(name, converter), str| h[name] = str.split(':', 2).last.__send__(converter) } super(h) end |
Instance Attribute Details
#table ⇒ Object
Returns the value of attribute table.
95 96 97 |
# File 'lib/seis_ruby/data/cmtsolution.rb', line 95 def table @table end |