Module: Atmospheric::Export::Target
- Included in:
- HypsometricalTables::TableBase, Iso25331975::GroupBase
- Defined in:
- lib/atmospheric/export/target.rb
Instance Method Summary collapse
- #ft_to_m(feet) ⇒ Object
- #m_to_ft(meters) ⇒ Object
- #round_to_sig_figs(num, num_sig_figs) ⇒ Object
- #to_file(hash = to_yaml) ⇒ Object
- #to_yaml ⇒ Object
Instance Method Details
#ft_to_m(feet) ⇒ Object
16 17 18 |
# File 'lib/atmospheric/export/target.rb', line 16 def ft_to_m(feet) Measured::Length.new(feet, "ft").convert_to("m").value.to_f end |
#m_to_ft(meters) ⇒ Object
12 13 14 |
# File 'lib/atmospheric/export/target.rb', line 12 def m_to_ft(meters) Measured::Length.new(meters, "m").convert_to("ft").value.to_f end |
#round_to_sig_figs(num, num_sig_figs) ⇒ Object
8 9 10 |
# File 'lib/atmospheric/export/target.rb', line 8 def round_to_sig_figs(num, num_sig_figs) num.round(num_sig_figs - Math.log10(num).ceil).to_f end |
#to_file(hash = to_yaml) ⇒ Object
27 28 29 |
# File 'lib/atmospheric/export/target.rb', line 27 def to_file(hash = to_yaml) File.write(filename, hash) end |
#to_yaml ⇒ Object
20 21 22 23 24 25 |
# File 'lib/atmospheric/export/target.rb', line 20 def to_yaml to_h .to_yaml(indentation: 4) .gsub("\n- ", "\n\n - ") .gsub(/^(.*):\n/, "\n\\1:") # Make fancy end |