Module: StringTensions::Convert
- Defined in:
- lib/string_tensions/convert.rb
Class Method Summary collapse
- .g_m_to_lbs_inch(g) ⇒ Object
- .inches_to_mm(inches) ⇒ Object
- .kg_to_lbs(kg) ⇒ Object
- .lbs_inch_to_g_m(lbs) ⇒ Object
- .lbs_to_kg(pounds) ⇒ Object
- .mm_to_inches(mm) ⇒ Object
- .unit(qty, dim) ⇒ Object
Class Method Details
.g_m_to_lbs_inch(g) ⇒ Object
22 23 24 |
# File 'lib/string_tensions/convert.rb', line 22 def self.g_m_to_lbs_inch(g) unit(g, 'g/m').to('lbs/inch').scalar.to_f end |
.inches_to_mm(inches) ⇒ Object
14 15 16 |
# File 'lib/string_tensions/convert.rb', line 14 def self.inches_to_mm(inches) unit(inches, 'inch').to('mm').scalar.to_f end |
.kg_to_lbs(kg) ⇒ Object
6 7 8 |
# File 'lib/string_tensions/convert.rb', line 6 def self.kg_to_lbs(kg) unit(kg, 'kg').to('lbs').scalar.to_f end |
.lbs_inch_to_g_m(lbs) ⇒ Object
26 27 28 |
# File 'lib/string_tensions/convert.rb', line 26 def self.lbs_inch_to_g_m(lbs) unit(lbs, 'lbs/inch').to('g/m').scalar.to_f end |
.lbs_to_kg(pounds) ⇒ Object
10 11 12 |
# File 'lib/string_tensions/convert.rb', line 10 def self.lbs_to_kg(pounds) unit(pounds, 'lbs').to('kg').scalar.to_f end |
.mm_to_inches(mm) ⇒ Object
18 19 20 |
# File 'lib/string_tensions/convert.rb', line 18 def self.mm_to_inches(mm) unit(mm, 'mm').to('inch').scalar.to_f end |
.unit(qty, dim) ⇒ Object
30 31 32 |
# File 'lib/string_tensions/convert.rb', line 30 def self.unit(qty, dim) ::Unit.new("#{qty} #{dim}") end |