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.



60
61
62
63
64
65
66
# File 'lib/seis_ruby/data/cmtsolution.rb', line 60

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.



67
68
69
# File 'lib/seis_ruby/data/cmtsolution.rb', line 67

def table
  @table
end