Class: SeisRuby::Data::Cmtsolution::Centroid

Inherits:
OpenStruct
  • Object
show all
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

Instance Method Summary collapse

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

#tableObject

Returns the value of attribute table.



95
96
97
# File 'lib/seis_ruby/data/cmtsolution.rb', line 95

def table
  @table
end