Sha256: cc433214b132e49b335fdba64a79fb99dae4e80f0e94387cdd8ce84e5a761a5b
Contents?: true
Size: 1.44 KB
Versions: 3
Compression:
Stored size: 1.44 KB
Contents
Units.create :length do |m| m.system :english do |s| s.unit :name => :inch, :plural => :inches, :abbrev => :in s.unit :name => :foot, :plural => :feet, :equals => 12.inches, :abbrev => :ft s.unit :name => :yard, :equals => 3.feet, :abbrev => :yd s.unit :name => :mile, :equals => 5280.feet, :abbrev => :mi s.unit :name => :nautical_mile, :equals => 1852.meters, :abbrev => :nmi s.format :name => :feet_inches_and_32s, :format => lambda { |u| ru = u.round_to_nearest(1.inch,32) feet = ru.feet.floor inches = (ru-feet).inches "#{feet} #{inches.with_fraction 32}" } end m.system :old_english do |s| s.unit :name => :fathom, :equals => 2.yards s.unit :name => :chain, :equals => 22.yards s.unit :name => :furlong, :equals => 660.feet s.unit :name => :league, :equals => 3.nmi end m.system :metric do |s| s.unit :name => :meter, :equals =>39.37.inches, :abbrev => :m, :greek => :ten s.unit :name => :anstrom, :equals => 0.1.nanometers, :abbrev => :A end m.system :astronomical do |s| s.unit :name => :astronomical_unit, :equals => 149598000.kilometers, :abbrev => :AU s.unit :name => :light_year, :equals => speed_of_light*(year.seconds), :abbrev => :ly s.unit :name => :parsec, :equals => 3.262.light_years, :abbrev => :pc end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
eymiha_units-0.1.0 | lib/units/definitions/length.rb |
eymiha_units-1.0.0 | lib/eymiha/units/definitions/length.rb |
eymiha_units-1.0.1 | lib/eymiha/units/definitions/length.rb |