gitt 3.0.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a62c7af41ef6056ceb816436a8c80f1d2ee3fd792fbbcadadbc82a2b5eba97d
4
- data.tar.gz: bc3d13fbd0296b5ca483f02033446fc79fbbd46617d0fd2b06cf07477ba06d3e
3
+ metadata.gz: fb7ec3501848841e8cf7107ae8ae9823b5e28aa04c5815ddf7a82357621a09ec
4
+ data.tar.gz: 4d88f589085bcd04af260b5231d12dd7e9b0121a311ee3d8788a7320eac32d09
5
5
  SHA512:
6
- metadata.gz: df96432454f47a6d4fd57c741949dabd088f61c1a62af03b25fac1860a766b52ecf19e7bd3973b29ee617e1c015588953ba34ca17fd56201f894ec9279819f80
7
- data.tar.gz: da01de46bb99ad4c59a328101772184703da241949ba9678dfb19c71c2e616a7fd6ab4d422035592ffe15473d33663e4e07e73fa9dede99c5e06660940d9ecdb
6
+ metadata.gz: 8beec7a750f4072983d768ea4bf4c306841660227c58848f2b2f99c5e35a0429d2c9dc3e8d2f5cbde5acfe9bfce6c73349d8877b17d5caa4e02df7a8e2cf399a
7
+ data.tar.gz: f058ef5e0878efc62b8125f91706d1f6bf75c66283b19b9ce4112183b74125fc18f7b3f658661993b4b0b88ffed108060e9579fb944cb6432c7e103dce61862c
checksums.yaml.gz.sig CHANGED
Binary file
data/gitt.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "gitt"
5
- spec.version = "3.0.0"
5
+ spec.version = "3.1.1"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/gitt"
@@ -10,6 +10,8 @@ module Gitt
10
10
  super
11
11
  end
12
12
 
13
+ def empty? = String(key).empty? || String(value).empty?
14
+
13
15
  def to_s = to_h.values.join
14
16
  end
15
17
  end
@@ -5,23 +5,27 @@ module Gitt
5
5
  # Parses raw trailer data to produce a trailer record.
6
6
  class Trailer
7
7
  PATTERN = /
8
- (?<key>\A.+) # Key (anchored to start of line).
9
- (?<delimiter>:) # Colon delimiter.
10
- (?<space>\s?) # Space (optional).
11
- (?<value>.*?) # Value.
12
- \Z # End of line.
8
+ \A # Start of line.
9
+ (?<key>.+) # Key.
10
+ (?<delimiter>:) # Colon delimiter.
11
+ (?<space>\s?) # Space (optional).
12
+ (?<value>.*?) # Value.
13
+ \Z # End of line.
13
14
  /x
14
15
 
15
- def initialize pattern: PATTERN, model: Models::Trailer
16
+ EMPTY = Models::Trailer[key: nil, value: nil]
17
+
18
+ def initialize pattern: PATTERN, model: Models::Trailer, empty: EMPTY
16
19
  @pattern = pattern
17
20
  @model = model
18
- @empty = model[key: nil, value: nil].to_h
21
+ @empty = empty
19
22
  end
20
23
 
21
24
  def call content
25
+ return empty if content.start_with? "#"
26
+
22
27
  content.match(pattern)
23
- .then { |data| data ? data.named_captures(symbolize_names: true) : empty }
24
- .then { |attributes| model[**attributes] }
28
+ .then { |data| data ? model[**data.named_captures(symbolize_names: true)] : empty }
25
29
  end
26
30
 
27
31
  private
@@ -8,7 +8,11 @@ module Gitt
8
8
  @parser = parser
9
9
  end
10
10
 
11
- def call(value) = String(value).split("\n").map { |text| parser.call text }
11
+ def call value
12
+ String(value).split("\n")
13
+ .map { |text| parser.call text }
14
+ .reject(&:empty?)
15
+ end
12
16
 
13
17
  private
14
18
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitt
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2024-01-01 00:00:00.000000000 Z
38
+ date: 2024-02-18 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: core
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.5.3
163
+ rubygems_version: 3.5.6
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: A monadic Object API for the Git CLI.
metadata.gz.sig CHANGED
Binary file