fiber_units 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18525eb39ab69336575ce1c0eb327ee299ed037cdf3bbf854b7e5f4af70520e3
4
- data.tar.gz: 645a4ed7eb065fa3b2c704e3dc46cca2a8ef4f1bfaafb01495fc982c1afc9ccb
3
+ metadata.gz: 82ac302d86901a24e9b0d6cd38cc5185978360173454fa13cdbacaa4c295e2de
4
+ data.tar.gz: 60d959472750dab825784939543b4e5ab1838b21173e069ca89ba1fe0290c82e
5
5
  SHA512:
6
- metadata.gz: 85beb04dc7b1db098924f40820db8272cff73c72d08e8ec75f62a392efea3b35edb256bccf6797bfde682bfbc0096203ef5f90cba022356c2ea9fb00928c29e1
7
- data.tar.gz: 267047384cc77ac732c5cf912d8db8cca2b9ca4e177cb84428e926d1639cca7bed95d8289b35fdac272fbe586b678001321c64bc6da392db5d4569eddac93e0a
6
+ metadata.gz: 78a95907d6a3b37167ac797f65e410a2c7f676fbb595f41b50b31089077bb21b99c4a113e0a6736637eb206d776f4190eb369838af9de2ef261f069004f71484
7
+ data.tar.gz: 77066078c243b350dd7bd144fa9452263105bb4bff9d0bc876e0a6f4ab304bea09e2bb6bdf5e8efda46de7985edf3738e9a104a3f8190597509ea1fb6417b80d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2026-03-09
4
+
5
+ ### Added
6
+ - Comparison operators (`<`, `>`, `<=`, `>=`, `==`, `!=`) for `Measurement` class
7
+ - Support for cross-unit comparisons (e.g., `4.inches > 10.centimeters`)
8
+ - Dimension safety checks in comparisons (raises error for incompatible units)
9
+
3
10
  ## [0.1.0] - 2026-03-09
4
11
 
12
+ ### Added
13
+ - Core `Measurement` class for representing and manipulating fiber unit measurements
14
+ - Dimension types: `Length`, `Weight`, `RowCount`, and `StitchCount`
15
+ - Conversion framework with `LengthConversion` and `WeightConversion` support
16
+ - Unit operations: addition, subtraction, multiplication, and division
17
+ - `Ratio` class for expressing relationships between measurements
18
+ - Numeric extensions for DSL-style usage (e.g., `10.cm`, `100.grams`)
19
+ - Comprehensive RBS type signatures for type checking support
5
20
  - Initial release
@@ -1,5 +1,7 @@
1
1
  module FiberUnits
2
2
  class Measurement
3
+ include Comparable
4
+
3
5
  attr_reader :value, :unit
4
6
 
5
7
  def initialize(value, unit)
@@ -39,6 +41,22 @@ module FiberUnits
39
41
  end
40
42
  end
41
43
 
44
+ def <=>(other)
45
+ ensure_same_dimension!(other)
46
+ to_base <=> other.to_base
47
+ end
48
+
49
+ def ==(other)
50
+ return false unless other.is_a?(Measurement)
51
+ return false unless other.is_a?(self.class)
52
+
53
+ (to_base - other.to_base).abs < 1e-10
54
+ end
55
+
56
+ def !=(other)
57
+ !(self == other)
58
+ end
59
+
42
60
  def to(target_unit)
43
61
  raise FiberUnits::InvalidUnitError unless self.class::FACTORS.key?(target_unit)
44
62
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FiberUnits
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiber_units
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meagan Waller