philiprehberger-env_diff 0.3.0 → 0.4.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: cb5b721f4c0ca4625cc7065f8e443aeaeb069394759e21829141bc2e551180c4
4
- data.tar.gz: 44866b77b4a8adeab0ac1550d1a53b995875cc444fc1fd67a7deb32bd1216035
3
+ metadata.gz: 5e512ec86bdcf2702d8c0d53552284aa43f5f51b6506e61d1275aad3af1e9dca
4
+ data.tar.gz: 7e65c48367a0e9d853c647e6339e40063ba23f8873f5e9668009a2c081cef5db
5
5
  SHA512:
6
- metadata.gz: 8e35a278641cbd4e7adaf9fe571e096a9ebd3a2521c56aed09750025e04265ddc743a8551d0efd94c5fb5b190b789fca7a9e995aad0deadef4dbffe973d5d04a
7
- data.tar.gz: 606bed2477c6205c621a5e4e728eeb6f22d8dc3e6f671ac66d7d3077a1948aed414cda0570207b5b5019a32a94e14cb40b4aed48c4b940fd0f5f4f0b02c03e69
6
+ metadata.gz: ec3677be78c8bc9df56fe6f2229fe625feae051ba6f6558f9d3bf0f033f0d575528a69ffe1c09642a6b8879bd01a363be75ef5a2524ddb46a19effe06fc59b1a
7
+ data.tar.gz: c79673bf83bfde8cd8aec1bcc824e08b6e82f7e39314d31c5a35fae8f87469f9398196d7dd04e92524550af9ac0a602152ed368cc27e22a8639f268c50085ec3
data/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.0] - 2026-04-24
11
+
12
+ ### Added
13
+ - `Diff#status_for(key)` — returns the status of a single key as a Symbol (`:added`, `:removed`, `:changed`, `:unchanged`), or `nil` if the key is absent from both sides
14
+
10
15
  ## [0.3.0] - 2026-04-14
11
16
 
12
17
  ### Added
data/README.md CHANGED
@@ -82,6 +82,16 @@ diff.stats
82
82
  # => { added: 1, removed: 1, changed: 1, unchanged: 1, total: 4 }
83
83
  ```
84
84
 
85
+ ### Per-key status
86
+
87
+ ```ruby
88
+ diff.status_for("NEW_KEY") # => :added
89
+ diff.status_for("OLD_KEY") # => :removed
90
+ diff.status_for("DATABASE_URL") # => :changed
91
+ diff.status_for("SECRET") # => :unchanged
92
+ diff.status_for("NOT_THERE") # => nil
93
+ ```
94
+
85
95
  ### Validation
86
96
 
87
97
  Check that all required keys exist in a target hash or `.env` file:
@@ -180,6 +190,7 @@ ENV
180
190
  | `Diff#to_json` | JSON serialization of the structured hash |
181
191
  | `Diff#filter(pattern:)` | New `Diff` containing only keys matching the regex pattern |
182
192
  | `Diff#stats` | Hash of counts: `:added`, `:removed`, `:changed`, `:unchanged`, `:total` |
193
+ | `Diff#status_for(key)` | Status of a single key as `:added`, `:removed`, `:changed`, `:unchanged`, or `nil` |
183
194
  | `Parser.parse(content)` | Parse `.env` string into a hash |
184
195
  | `Parser.parse_file(path:)` | Read and parse a `.env` file |
185
196
 
@@ -92,6 +92,19 @@ module Philiprehberger
92
92
  }
93
93
  end
94
94
 
95
+ # Status of a single key in this diff.
96
+ #
97
+ # @param key [String] the key to look up
98
+ # @return [Symbol, nil] one of :added, :removed, :changed, :unchanged, or nil if absent from both sides
99
+ def status_for(key)
100
+ return :added if @added.include?(key)
101
+ return :removed if @removed.include?(key)
102
+ return :changed if @changed.key?(key)
103
+ return :unchanged if @unchanged.include?(key)
104
+
105
+ nil
106
+ end
107
+
95
108
  private
96
109
 
97
110
  def build_changed(source, target)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Philiprehberger
4
4
  module EnvDiff
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: philiprehberger-env_diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Rehberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-15 00:00:00.000000000 Z
11
+ date: 2026-04-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Parse .env files or environment hashes, compare them, and get a clear
14
14
  report of added, removed, changed, and unchanged variables.