code styling

This commit is contained in:
Michael Go
2025-01-07 14:32:46 -04:00
parent e9f86724f6
commit 313d01706a
3 changed files with 6 additions and 4 deletions
+3
View File
@@ -21,6 +21,8 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
require "strscan"
module Liquid module Liquid
FilterSeparator = /\|/ FilterSeparator = /\|/
ArgumentSeparator = ',' ArgumentSeparator = ','
@@ -44,6 +46,7 @@ module Liquid
VariableParser = /\[(?>[^\[\]]+|\g<0>)*\]|#{VariableSegment}+\??/o VariableParser = /\[(?>[^\[\]]+|\g<0>)*\]|#{VariableSegment}+\??/o
RAISE_EXCEPTION_LAMBDA = ->(_e) { raise } RAISE_EXCEPTION_LAMBDA = ->(_e) { raise }
HAS_STRING_SCANNER_SCAN_BYTE = StringScanner.instance_methods.include?(:scan_byte)
end end
require "liquid/version" require "liquid/version"
+2 -1
View File
@@ -160,5 +160,6 @@ module Liquid
end end
end end
Expression = StringScanner.instance_methods.include?(:scan_byte) ? Expression2 : Expression1 # Remove this once we can depend on strscan >= 3.1.1
Expression = HAS_STRING_SCANNER_SCAN_BYTE ? Expression2 : Expression1
end end
+1 -3
View File
@@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require "strscan"
module Liquid module Liquid
class Lexer1 class Lexer1
SPECIALS = { SPECIALS = {
@@ -229,5 +227,5 @@ module Liquid
end end
# Remove this once we can depend on strscan >= 3.1.1 # Remove this once we can depend on strscan >= 3.1.1
Lexer = StringScanner.instance_methods.include?(:scan_byte) ? Lexer2 : Lexer1 Lexer = HAS_STRING_SCANNER_SCAN_BYTE ? Lexer2 : Lexer1
end end