-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from shivam091/3.2.0
3.2.0
- Loading branch information
Showing
10 changed files
with
171 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
unit_measurements (3.1.0) | ||
unit_measurements (3.2.0) | ||
activesupport (~> 7.0) | ||
|
||
GEM | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
UnitMeasurements::Acceleration = UnitMeasurements.build do | ||
si_unit :"m/s²", aliases: [:"m/s^2", :"m·s⁻²", :"meter per second squared", :"meters per second squared", :"metre per second squared", :"metres per second squared"] | ||
|
||
unit :"in/s²", value: "0.0254 m/s²", aliases: [:"in/s^2", :"in·s⁻²", :"inch per second squared", :"inches per second squared"] | ||
unit :"ft/s²", value: "0.3048 m/s²", aliases: [:"ft/s^2", :"ft·s⁻²", :"foot per second squared", :"feet per second squared"] | ||
unit :"Kn/s", value: "0.5144444 m/s²", aliases: [:"knot per second", :"knots per second"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
UnitMeasurements::AngularAcceleration = UnitMeasurements.build do | ||
si_unit :"rad/s²", aliases: [:"rad/s^2", :"rad·s⁻²", :"radian per second squared", :"radians per second squared"] | ||
|
||
unit :"deg/s²", value: [(Math::PI / 180), :"rad/s²"], aliases: [:"deg/s^2", :"°/s²", :"deg·s⁻²", :"degree per second squared", :"degrees per second squared"] | ||
unit :"gon/s²", value: [(Math::PI / 200), :"rad/s²"], aliases: [:"gon/s^2", :"ᵍ/s²", :"gon·s⁻²", :"gradian per second squared", :"gradians per second squared"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
# -*- warn_indent: true -*- | ||
|
||
module UnitMeasurements | ||
VERSION = "3.1.0" | ||
VERSION = "3.2.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
# spec/unit_measurements/unit_groups/acceleration_spec.rb | ||
|
||
RSpec.describe UnitMeasurements::Acceleration do | ||
describe "m/s²" do | ||
subject { described_class.new(2, "m/s²") } | ||
|
||
it "converts to in/s²" do | ||
expect(subject.convert_to("in/s²").quantity).to eq(78.740157480315) | ||
end | ||
|
||
it "converts to ft/s²" do | ||
expect(subject.convert_to("ft/s²").quantity).to eq(6.56167979002625) | ||
end | ||
|
||
it "converts to Kn/s" do | ||
expect(subject.convert_to("Kn/s").quantity).to eq(3.8876893207507) | ||
end | ||
end | ||
|
||
describe "in/s²" do | ||
subject { described_class.new(2, "in/s²") } | ||
|
||
it "converts to m/s²" do | ||
expect(subject.convert_to("m/s²").quantity).to eq(0.0508) | ||
end | ||
|
||
it "converts to ft/s²" do | ||
expect(subject.convert_to("ft/s²").quantity).to eq(0.166666666666667) | ||
end | ||
|
||
it "converts to Kn/s" do | ||
expect(subject.convert_to("Kn/s").quantity).to eq(0.0987473087470677) | ||
end | ||
end | ||
|
||
describe "ft/s²" do | ||
subject { described_class.new(2, "ft/s²") } | ||
|
||
it "converts to m/s²" do | ||
expect(subject.convert_to("m/s²").quantity).to eq(0.6096) | ||
end | ||
|
||
it "converts to in/s²" do | ||
expect(subject.convert_to("in/s²").quantity).to eq(24) | ||
end | ||
|
||
it "converts to Kn/s" do | ||
expect(subject.convert_to("Kn/s").quantity).to eq(1.18496770496481) | ||
end | ||
end | ||
|
||
describe "Kn/s" do | ||
subject { described_class.new(2, "Kn/s") } | ||
|
||
it "converts to m/s²" do | ||
expect(subject.convert_to("m/s²").quantity).to eq(1.0288888) | ||
end | ||
|
||
it "converts to in/s²" do | ||
expect(subject.convert_to("in/s²").quantity).to eq(40.5074330708661) | ||
end | ||
|
||
it "converts to ft/s²" do | ||
expect(subject.convert_to("ft/s²").quantity).to eq(3.37561942257218) | ||
end | ||
end | ||
end |
43 changes: 43 additions & 0 deletions
43
spec/unit_measurements/unit_groups/angular_acceleration_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
# spec/unit_measurements/unit_groups/angular_acceleration_spec.rb | ||
|
||
RSpec.describe UnitMeasurements::AngularAcceleration do | ||
describe "rad/s²" do | ||
subject { described_class.new(2, "rad/s²") } | ||
|
||
it "converts to deg/s²" do | ||
expect(subject.convert_to("deg/s²").quantity).to eq(114.591559026165) | ||
end | ||
|
||
it "converts to gon/s²" do | ||
expect(subject.convert_to("gon/s²").quantity).to eq(127.323954473516) | ||
end | ||
end | ||
|
||
describe "deg/s²" do | ||
subject { described_class.new(2, "deg/s²") } | ||
|
||
it "converts to rad/s²" do | ||
expect(subject.convert_to("rad/s²").quantity).to eq(0.0349065850398866) | ||
end | ||
|
||
it "converts to gon/s²" do | ||
expect(subject.convert_to("gon/s²").quantity).to eq(2.22222222222222) | ||
end | ||
end | ||
|
||
describe "gon/s²" do | ||
subject { described_class.new(2, "gon/s²") } | ||
|
||
it "converts to rad/s²" do | ||
expect(subject.convert_to("rad/s²").quantity).to eq(0.0314159265358979) | ||
end | ||
|
||
it "converts to deg/s²" do | ||
expect(subject.convert_to("deg/s²").quantity).to eq(1.8) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters