ngworder 0.1.0 → 0.1.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: b04b0792948a68e7ccff32a55eb8619d38eab72f5b3d2826b37529bbbe72bedf
4
- data.tar.gz: 1ea0b3c87b1f246cb6bd35f2589934915fa240c9addf7640b1721f62e141d9cd
3
+ metadata.gz: 889f89130c4888e512729e7cba02a6de8ed641b1d602f11727ffe38ed689609e
4
+ data.tar.gz: cd10c6139594e5f4c8b3da5c6a32461f6f122799a6cde7f82a3ad7080a8cd772
5
5
  SHA512:
6
- metadata.gz: f6dcba982aa0602c7787ebfedbdcaa8cd33fb7191780de58135f41b587890c53e429c4ab8c37eb503efab23236b48fda9bafb098ccc96d72df689c5825ea6597
7
- data.tar.gz: 6354451f11ed56d97fe1b1f816026f9b75da01cdc8e7aa9c79343cfb13aae350b086b6332d1c98a7014b6f97aece3627c3d4b902fb8ac1a47d59be897e1ec70e
6
+ metadata.gz: 893e15048ef240a304ffee81f1f8ba92a85335227b44eed47de2e11495881d316ea7f0f9c3ea9c2e418c370514b1b88ad7474873761251b1fb51f1ebab2bd2da
7
+ data.tar.gz: 528b003d4c2da44561827b70fba0fe50190e825dd634f6ac2fd42d53aaf80aa9d1befab73dcc7673e99caf071e78c1e9f0e3ff4e3bbc9c0f6843e4b6044449d2
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ngworder
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/ngworder.rb CHANGED
@@ -100,8 +100,15 @@ module Ngworder
100
100
  backslashes.even?
101
101
  end
102
102
 
103
- def parse_matcher(raw)
104
- trimmed = raw.strip
103
+ def parse_matcher(raw, trim: :both)
104
+ trimmed = case trim
105
+ when :right
106
+ raw.rstrip
107
+ when :none
108
+ raw
109
+ else
110
+ raw.strip
111
+ end
105
112
  return nil if trimmed.empty?
106
113
 
107
114
  if trimmed.start_with?("/") && trimmed.length >= 2 && trimmed.end_with?("/")
@@ -120,14 +127,14 @@ module Ngworder
120
127
  rules = []
121
128
 
122
129
  File.readlines(path, chomp: true).each do |line|
123
- content = strip_comment(line).strip
124
- next if content.empty?
130
+ content = strip_comment(line)
131
+ next if content.strip.empty?
125
132
 
126
133
  parts = split_unescaped_bang(content)
127
- base = parse_matcher(parts.shift || "")
134
+ base = parse_matcher(parts.shift || "", trim: :right)
128
135
  next unless base
129
136
 
130
- excludes = parts.map { |part| parse_matcher(part) }.compact
137
+ excludes = parts.map { |part| parse_matcher(part, trim: :both) }.compact
131
138
  rules << Rule.new(base, base.label, excludes)
132
139
  end
133
140
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ngworder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masanori Kado