fiber_units 0.2.0 → 0.3.1

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: 82ac302d86901a24e9b0d6cd38cc5185978360173454fa13cdbacaa4c295e2de
4
- data.tar.gz: 60d959472750dab825784939543b4e5ab1838b21173e069ca89ba1fe0290c82e
3
+ metadata.gz: 9a36810277081c2d93d374391787a83b23479f7c908c9732c9998b280c3037e1
4
+ data.tar.gz: 332925d03d8d1f165c298119930d0a473603f5a13eb307ee6de20d6081759dcf
5
5
  SHA512:
6
- metadata.gz: 78a95907d6a3b37167ac797f65e410a2c7f676fbb595f41b50b31089077bb21b99c4a113e0a6736637eb206d776f4190eb369838af9de2ef261f069004f71484
7
- data.tar.gz: 77066078c243b350dd7bd144fa9452263105bb4bff9d0bc876e0a6f4ab304bea09e2bb6bdf5e8efda46de7985edf3738e9a104a3f8190597509ea1fb6417b80d
6
+ metadata.gz: 3f11e17bffa1672ab5a72a1bc6811b405af16ba0be45cc5c2ae23eb208749f894b6af2b8df1f0a4fdce10ce283735914f0f319a6b793838b39982034036a7f4a
7
+ data.tar.gz: de49d0510c7c1bd3e9717c0f347027880d5eb453e36e74841b551badb6f90bd07d47ab741d117793d34af64f2261a1730b2ed7190c88b140d5bc15ecffd04a81
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.1] - 2026-03-14
4
+
5
+ ### Changed
6
+ - GitHub Actions now publishes on version tag pushes and creates a matching GitHub release
7
+
8
+ ## [0.3.0] - 2026-03-14
9
+
10
+ ### Added
11
+ - Shared `Count` base class for `RowCount` and `StitchCount`
12
+ - Equality and comparison behavior for `StitchCount` and `RowCount`
13
+ - Coverage for shared count behavior through `RowCount` and `StitchCount` specs
14
+
3
15
  ## [0.2.0] - 2026-03-09
4
16
 
5
17
  ### Added
@@ -0,0 +1,48 @@
1
+ module FiberUnits
2
+ class Count
3
+ include Comparable
4
+
5
+ attr_reader :value
6
+
7
+ def initialize(value, _unit = nil)
8
+ @value = value
9
+ freeze
10
+ end
11
+
12
+ def +(other)
13
+ ensure_same_class!(other)
14
+ self.class.new(value + other.value)
15
+ end
16
+
17
+ def -(other)
18
+ ensure_same_class!(other)
19
+ self.class.new(value - other.value)
20
+ end
21
+
22
+ def *(other)
23
+ self.class.new(value * other)
24
+ end
25
+
26
+ def to_i
27
+ value
28
+ end
29
+
30
+ def <=>(other)
31
+ return nil unless other.instance_of?(self.class)
32
+ value <=> other.value
33
+ end
34
+
35
+ def ==(other)
36
+ other.class == self.class && other.value == value
37
+ end
38
+
39
+ private
40
+
41
+ def ensure_same_class!(other)
42
+ unless other.instance_of?(self.class)
43
+ raise FiberUnits::DimensionError,
44
+ "Cannot combine #{self.class} with #{other.class}"
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,13 +1,4 @@
1
1
  module FiberUnits
2
- class RowCount
3
- attr_reader :value
4
-
5
- def initialize(value, _unit = nil)
6
- @value = value
7
- end
8
-
9
- def +(other)
10
- RowCount.new(value + other.value)
11
- end
2
+ class RowCount < Count
12
3
  end
13
4
  end
@@ -1,13 +1,4 @@
1
1
  module FiberUnits
2
- class StitchCount
3
- attr_reader :value
4
-
5
- def initialize(value, _unit = nil)
6
- @value = value
7
- end
8
-
9
- def +(other)
10
- StitchCount.new(value + other.value)
11
- end
2
+ class StitchCount < Count
12
3
  end
13
4
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FiberUnits
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.1"
5
5
  end
data/lib/fiber_units.rb CHANGED
@@ -8,6 +8,7 @@ require_relative "fiber_units/conversions/weight_conversion"
8
8
 
9
9
  require_relative "fiber_units/dimensions/length"
10
10
  require_relative "fiber_units/dimensions/weight"
11
+ require_relative "fiber_units/dimensions/count"
11
12
  require_relative "fiber_units/dimensions/stitch_count"
12
13
  require_relative "fiber_units/dimensions/row_count"
13
14
 
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.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meagan Waller
@@ -28,6 +28,7 @@ files:
28
28
  - lib/fiber_units.rb
29
29
  - lib/fiber_units/conversions/length_conversion.rb
30
30
  - lib/fiber_units/conversions/weight_conversion.rb
31
+ - lib/fiber_units/dimensions/count.rb
31
32
  - lib/fiber_units/dimensions/length.rb
32
33
  - lib/fiber_units/dimensions/row_count.rb
33
34
  - lib/fiber_units/dimensions/stitch_count.rb