srx 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +5 -5
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/srx/data.rb +2 -2
- data/lib/srx/engine.rb +3 -2
- data/lib/srx/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 153660bff1d0fc6c00bebc7fae34b11d9f70b16c54628ebf5023f8815b105b45
|
4
|
+
data.tar.gz: 1e01d70b8f8a3cb032e62137f7ab1224e3942bb2314a47c05af295ff6431ba35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3ac37ecbb4bba2c31d90d32f3b4c0ae4cd236a70e6ab25c340f35c52e12364d4aad14dff01e0b8381fd28811ea46f6f861d1ff23540c0f280575cbbd24d1262
|
7
|
+
data.tar.gz: b89f432b242e1bd8e2b8e5917888d78f75ef9749b2add35e9991a4d33e38be8876c110e107b994f27bdaf214612f231c1cd2041a0090759f053d839f7bd3d741
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2021-02-
|
3
|
+
# on 2021-02-25 04:43:35 UTC using RuboCop version 1.10.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 5
|
10
10
|
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
11
11
|
Metrics/AbcSize:
|
12
|
-
Max:
|
12
|
+
Max: 24
|
13
13
|
|
14
14
|
# Offense count: 6
|
15
15
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
@@ -25,9 +25,9 @@ Metrics/CyclomaticComplexity:
|
|
25
25
|
# Offense count: 9
|
26
26
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
27
27
|
Metrics/MethodLength:
|
28
|
-
Max:
|
28
|
+
Max: 26
|
29
29
|
|
30
|
-
# Offense count:
|
30
|
+
# Offense count: 1
|
31
31
|
# Configuration parameters: IgnoredMethods.
|
32
32
|
Metrics/PerceivedComplexity:
|
33
33
|
Max: 10
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.5.0] - 2021-02-25
|
4
|
+
|
5
|
+
- When `nil` is supplied for the `language` parameter, it is now treated as the
|
6
|
+
empty string for rule-matching purposes (previously it would match no rules)
|
7
|
+
|
3
8
|
## [0.4.0] - 2021-02-18
|
4
9
|
|
5
10
|
- Optimize memory usage
|
data/Gemfile.lock
CHANGED
data/lib/srx/data.rb
CHANGED
@@ -130,13 +130,13 @@ module Srx
|
|
130
130
|
# Eagerly load everything for this class because before_break and
|
131
131
|
# after_break can be legitimately nil, so lazy loading gets ugly.
|
132
132
|
|
133
|
-
@break = @xml['break'].nil? ||
|
133
|
+
@break = @xml['break'].then { |brk| brk.nil? || brk == 'yes' }
|
134
134
|
|
135
135
|
@before_break = xpath(:beforebreak).first&.text.then do |pattern|
|
136
136
|
IcuRegex.compile(pattern) if pattern
|
137
137
|
end
|
138
138
|
|
139
|
-
@after_break
|
139
|
+
@after_break = xpath(:afterbreak).first&.text.then do |pattern|
|
140
140
|
IcuRegex.compile(pattern) if pattern
|
141
141
|
end
|
142
142
|
end
|
data/lib/srx/engine.rb
CHANGED
@@ -45,9 +45,11 @@ module Srx
|
|
45
45
|
names.flat_map { |name| rule_map[name].rules }
|
46
46
|
end
|
47
47
|
|
48
|
-
# @param language [String]
|
48
|
+
# @param language [String] nil treated as empty string
|
49
49
|
# @return [Array<String>]
|
50
50
|
def rule_names(language)
|
51
|
+
language ||= ''
|
52
|
+
|
51
53
|
@data.map_rules.map do |lang_map|
|
52
54
|
next unless lang_map.language_pattern.match?(language)
|
53
55
|
|
@@ -58,7 +60,6 @@ module Srx
|
|
58
60
|
end
|
59
61
|
|
60
62
|
# @param str [String]
|
61
|
-
# @param pos [Integer] the position to start searching from
|
62
63
|
# @param rules [Array<Data::LanguageRule::Rule>]
|
63
64
|
# @return [Array<Array(Integer,Data::LanguageRule::Rule)>] an array of pairs
|
64
65
|
# of 1) the position of a break, and 2) the rule that matched at that
|
data/lib/srx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: srx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Madlon-Kay
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|