Skip to content

Commit

Permalink
Rename new option predicate to avoid conflict with existing Node meth…
Browse files Browse the repository at this point in the history
…od [rubocop#20]
  • Loading branch information
marcandre committed Jun 7, 2020
1 parent bf04f35 commit 7018790
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/rubocop/ast/node/regexp_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def interpolation?
end

# @return [Bool] if regexp uses the multiline regopt
def multiline?
def multiline_mode?
regopt_include?(:m)
end

Expand Down
10 changes: 5 additions & 5 deletions spec/rubocop/ast/regexp_node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,29 +161,29 @@
end
end

describe '#multiline?' do
describe '#multiline_mode?' do
context 'with no options' do
let(:source) { '/x/' }

it { expect(regexp_node.multiline?).to be(false) }
it { expect(regexp_node.multiline_mode?).to be(false) }
end

context 'with other options' do
let(:source) { '/x/ix' }

it { expect(regexp_node.multiline?).to be(false) }
it { expect(regexp_node.multiline_mode?).to be(false) }
end

context 'with only m option' do
let(:source) { '/x/m' }

it { expect(regexp_node.multiline?).to be(true) }
it { expect(regexp_node.multiline_mode?).to be(true) }
end

context 'with m and other options' do
let(:source) { '/x/imx' }

it { expect(regexp_node.multiline?).to be(true) }
it { expect(regexp_node.multiline_mode?).to be(true) }
end
end

Expand Down

0 comments on commit 7018790

Please sign in to comment.