Skip to content

Commit 94e4bb3

Browse files
committed
don't change value of objects you don't own
1 parent ab1bb26 commit 94e4bb3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/coderay/scanners/css.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def setup
5353
end
5454

5555
def scan_tokens encoder, options
56-
states = Array(options[:state] || @state)
56+
states = Array(options[:state] || @state).dup
5757
value_expected = @value_expected
5858

5959
until eos?

lib/coderay/scanners/sass.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def setup
1919
end
2020

2121
def scan_tokens encoder, options
22-
states = Array(options[:state] || @state)
22+
states = Array(options[:state] || @state).dup
2323
string_delimiter = nil
2424

2525
until eos?
@@ -119,7 +119,7 @@ def scan_tokens encoder, options
119119

120120
else
121121
#:nocov:
122-
raise_inspect 'Unknown state', encoder
122+
raise_inspect 'Unknown state: %p' % [states.last], encoder
123123
#:nocov:
124124

125125
end
@@ -215,7 +215,7 @@ def scan_tokens encoder, options
215215
end
216216

217217
if options[:keep_state]
218-
@state = states
218+
@state = states.dup
219219
end
220220

221221
while state = states.pop

0 commit comments

Comments
 (0)