Skip to content

Commit

Permalink
Merge pull request #52 from shivam091/5.4.0
Browse files Browse the repository at this point in the history
5.4.0
  • Loading branch information
shivam091 authored Oct 27, 2023
2 parents ba71b78 + 8dba719 commit 7efc587
Show file tree
Hide file tree
Showing 8 changed files with 1,344 additions and 64 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [5.4.0](https://github.com/shivam091/unit_measurements/compare/v5.3.0...v5.4.0) - 2023-10-27

### What's new

- Added new units `Å`, `lnk`, `lea`, `hh`, `nl`, and `sft` in length.
- Added new units `N`, `s`, `drt`, and `lbt` in weight.

----------

## [5.3.0](https://github.com/shivam091/unit_measurements/compare/v5.2.0...v5.3.0) - 2023-10-24

### What's new
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
unit_measurements (5.3.0)
unit_measurements (5.4.0)
activesupport (~> 7.0)

GEM
Expand Down
16 changes: 14 additions & 2 deletions lib/unit_measurements/unit_groups/length.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,31 @@

system :metric do
si_unit "m", aliases: ["meter", "metre", "meters", "metres"]

unit "Å", value: "1e-10 m", aliases: ["angstrom", "angstroms", "ångström"]
end

system :imperial do
unit "h", value: "4 in", aliases: ["hh", "hand", "hands"]

unit "in", value: "25.4 mm", aliases: ['"', "inch", "inches"]
unit "ft", value: "12 in", aliases: ["'", "foot", "feet"]
unit "yd", value: "3 ft", aliases: ["yard", "yards"]
unit "mi", value: "1760 yd", aliases: ["mile", "miles", "statute mile", "international mile"]
unit "mi", value: "5280 ft", aliases: ["mile", "miles", "statute mile", "international mile"]
unit "ch", value: "22 yd", aliases: ["chain", "chains"]
unit "th", value: "1/1000 in", aliases: ["thou", "thousandth of an inch"]
unit "th", value: "1/1000 in", aliases: ["thou", "thousandth of an inch", "mil", "mils"]
unit "nl", value: "3 nmi", aliases: ["NL", "nleague", "nleagues", "nautical league", "nautical leagues"]

unit "ftm", value: "6 ft", aliases: ["fathom", "fathoms"]
unit "fur", value: "220 yd", aliases: ["furlong", "furlongs"]
unit "nmi", value: "1852 m", aliases: ["NMI", "M", "NM", "nautical mile", "nautical miles"]
unit "rod", value: "16 1/2 ft", aliases: ["rods", "perch", "pole", "lug"]
unit "lnk", value: "33/50 ft", aliases: ["l", "li", "link", "links"]
unit "lea", value: "3 mi", aliases: ["league", "leagues"]
end

system :us_customary do
unit "sft", value: "1200/3937 m", aliases: ["sfoot", "sfeet", "survey-foot", "survey-feet"]
end

system :astronomical do
Expand Down
23 changes: 12 additions & 11 deletions lib/unit_measurements/unit_groups/weight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@

unit "q", value: "100 kg", aliases: ["quintal", "quintals"]
unit "t", value: "1000 kg", aliases: ["tonne", "tonnes", "metric tonne", "metric tonnes"]
unit "N", value: "0.10197162129779283 kg", aliases: ["newton", "newtons"]

unit "ct", value: "200 mg", aliases: ["carat", "carats"]
unit "Da", value: "1.660538921e-27 kg", aliases: ["dalton", "daltons"]
end

system :imperial do
unit "lb", value: [Rational(45_359_237, 1e+8), "kg"], aliases: ["lbs", "lbm", "pound-mass", "pound", "pounds", "#"]
unit "s", value: "20 gr", aliases: ["scruple", "scruples"]

unit "lb", value: "0.45359237 kg", aliases: ["lbs", "lbm", "pound-mass", "pound", "pounds", "#"]
unit "st", value: "14 lb", aliases: ["stone", "stones"]
unit "oz", value: [Rational(1, 16), "lb"], aliases: ["ounce", "ounces"]
end
unit "oz", value: "1/16 lb", aliases: ["ounce", "ounces"]
unit "dr", value: "1/16 oz", aliases: ["dram", "drams"]
unit "gr", value: "1/7000 lb", aliases: ["grain", "grains"]

system :troy_weight do
unit "gr", value: [Rational(1, 7000), "lb"], aliases: ["grain", "grains"]
unit "drt", value: "60 gr", aliases: ["troy dram", "troy drams"]
unit "ozt", value: "480 gr", aliases: ["troy ounce", "troy ounces"]
unit "dwt", value: [Rational(1, 20), "ozt"], aliases: ["pennyweight", "pennyweights"]
end

system :avoirdupois do
unit "dr", value: [Rational(1, 16), "oz"], aliases: ["dram", "drams"]
unit "lbt", value: "5760 gr", aliases: ["troy pound", "troy pounds"]
unit "dwt", value: "1/20 ozt", aliases: ["pwt", "pennyweight", "pennyweights"]
end

system :foot_pound_second do
unit "slug", value: "32.1740 lb", aliases: ["slugs"]
unit "slug", value: "32.17404856 lb", aliases: ["slugs"]
end
end
2 changes: 1 addition & 1 deletion lib/unit_measurements/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

module UnitMeasurements
# Current stable version.
VERSION = "5.3.0"
VERSION = "5.4.0"
end
Loading

0 comments on commit 7efc587

Please sign in to comment.