Skip to content

Commit a443be7

Browse files
committed
Ruby scanner accepts :state options and provides #interpreted_string_state method
1 parent 9975fcb commit a443be7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/coderay/scanners/ruby.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ class Ruby < Scanner
1616
autoload :Patterns, 'coderay/scanners/ruby/patterns'
1717
autoload :StringState, 'coderay/scanners/ruby/string_state'
1818

19+
def interpreted_string_state
20+
StringState.new :string, true, '"'
21+
end
22+
1923
protected
2024

2125
def setup
2226
@state = :initial
2327
end
2428

2529
def scan_tokens encoder, options
26-
state, heredocs = @state
30+
state, heredocs = options[:state] || @state
2731
heredocs = heredocs.dup if heredocs.is_a?(Array)
2832

2933
if state && state.instance_of?(StringState)

0 commit comments

Comments
 (0)