yoga 0.3.0 → 0.3.2
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 +4 -4
- data/lib/yoga/scanner.rb +6 -4
- data/lib/yoga/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e30bbc7d17d9d4847b096576cc5efb39c71eec4e
|
4
|
+
data.tar.gz: 5813baee5ef2e6704fa2db41a3f77316e478ec3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d6a878a6eaaf68427d1c4b873c465d82d82a61bef900f5f53cd173dc2e12b83e17e0bca277511edf3bfde66b009755a2272e75a9c6f6232a45cad8e253d0458
|
7
|
+
data.tar.gz: 642ddf68de1ce8acd8d69d198eaa4f7af87abd45c1deaba76e230b738f3abcb8aedad2dfec061bb4f01b1816f4d5527be5c8b9f59e0f755b057b50491ec2d277
|
data/lib/yoga/scanner.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require "strscan"
|
5
|
+
|
4
6
|
module Yoga
|
5
7
|
# A scanner. This performs scanning over a series of tokens.
|
6
8
|
# It is built to lazily scan whenever it is required, instead
|
@@ -94,7 +96,7 @@ module Yoga
|
|
94
96
|
# A regular expression to match all kinds of lines. All of them.
|
95
97
|
#
|
96
98
|
# @return [::Regexp]
|
97
|
-
|
99
|
+
LINE = /\r\n|\n\r|\n|\r/
|
98
100
|
|
99
101
|
# Attempts to match the given token. The first argument can be a string,
|
100
102
|
# a symbol, or a regular expression. If the matcher is a symbol, it's
|
@@ -129,7 +131,7 @@ module Yoga
|
|
129
131
|
#
|
130
132
|
# @return [Boolean] If the line was matched.
|
131
133
|
def match_line(kind = false)
|
132
|
-
match(
|
134
|
+
match(LINE, kind)
|
133
135
|
end
|
134
136
|
|
135
137
|
# Returns the number of lines that have been covered so far in the scanner.
|
@@ -167,10 +169,10 @@ module Yoga
|
|
167
169
|
# @api private
|
168
170
|
# @return [void]
|
169
171
|
def update_line_information
|
170
|
-
return unless (lines = @scanner[0].scan(
|
172
|
+
return unless (lines = @scanner[0].scan(LINE)).any?
|
171
173
|
@line += lines.size
|
172
174
|
@last_line_at =
|
173
|
-
@scanner.string.rindex(
|
175
|
+
@scanner.string.rindex(LINE, @scanner.charpos) + 1
|
174
176
|
end
|
175
177
|
end
|
176
178
|
end
|
data/lib/yoga/version.rb
CHANGED