Sha256: 5aa611cdd2e050c2594fd2544f59f4c2a920d31cf4420e4309bb2fe08cc91d93

Contents?: true

Size: 600 Bytes

Versions: 2

Compression:

Stored size: 600 Bytes

Contents

class Stormglass::AlternateValues::MetersSec

  def self.perform(subvalues)
    inject_knots(subvalues)
    inject_mph(subvalues)
  end

  private

  def self.inject_knots(subvalues)
    subvalues << {unit_type: 'knot', unit: 'Kn', value: (subvalues.first[:value] * 1.9438445).round(2), description: subvalues.first[:description], unit_description: 'nautical knots'}
  end

  def self.inject_mph(subvalues)
    subvalues << {unit_type: 'MPH', unit: 'MPH', value: (subvalues.first[:value] * 2.236936).round(2), description: subvalues.first[:description], unit_description: 'miles per hour'}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stormglass-0.2.0 lib/stormglass/alternate_values/meters_sec.rb
stormglass-0.1.1 lib/stormglass/alternate_values/meters_sec.rb