Skip to content

Commit

Permalink
Support false frozen_string_literals
Browse files Browse the repository at this point in the history
Fixes #1363
  • Loading branch information
lsegal committed Dec 25, 2020
1 parent 7104257 commit f32ef62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/yard/parser/source_parser.rb
Expand Up @@ -64,7 +64,7 @@ def parse
class SourceParser
SHEBANG_LINE = /\A\s*#!\S+/
ENCODING_LINE = %r{\A(?:\s*#*!.*\r?\n)?\s*(?:#+|/\*+|//+).*coding\s*[:=]{1,2}\s*([a-z\d_\-]+)}i
FROZEN_STRING_LINE = /frozen(-|_)string(-|_)literal: true/i
FROZEN_STRING_LINE = /frozen(-|_)string(-|_)literal:\s+(true|false)/i

# The default glob of files to be parsed.
# @since 0.9.0
Expand Down
2 changes: 1 addition & 1 deletion spec/parser/ruby/ruby_parser_spec.rb
Expand Up @@ -508,7 +508,7 @@ def bar; end if true

it "removes frozen string line from initial file comments" do
YARD.parse_string "# frozen_string_literal: true\n# this is a comment\nclass Foo; end"
YARD.parse_string "# Frozen-string-literal: true\n# this is a comment\nclass Bar; end"
YARD.parse_string "# Frozen-string-literal: false\n# this is a comment\nclass Bar; end"

expect(Registry.at(:Foo).docstring).to eq "this is a comment"
expect(Registry.at(:Bar).docstring).to eq "this is a comment"
Expand Down

0 comments on commit f32ef62

Please sign in to comment.