Skip to content
Browse files

Remove nesting of public/private/protected sections

  • Loading branch information...
1 parent 5c4d27b commit f5efb16894de30b131c8eb74a18ffa550ee8ad0e @mocoso committed Nov 14, 2011
View
6 Support/lib/rbeautify/config/ruby.rb
@@ -55,12 +55,6 @@
/(((^|;|\s)end)|#{continue_statement_boundary}(rescue|ensure))\b/,
:nest_except => [:double_quote, :regex, :backtick])
- ruby.add_matcher(:implicit_end,
- /^(public|protected|private)$/,
- /^(public|protected|private)(\s*)?(#.*)?$/,
- :end => :implicit,
- :nest_except => [:double_quote, :regex, :backtick])
-
ruby.add_matcher(:more,
/#{start_statement_boundary}(until|for|while)\b/,
/(((^|;|\s)end)|#{continue_statement_boundary}(rescue|ensure))\b/,
View
24 Support/spec/fixtures/ruby.yml
@@ -193,30 +193,6 @@
b = 5
end
-- name: end indentation of implicit blocks when another implicit block starts or when surrounding block ends
- input: |
- class Foo
- private
- def method
- b = 5
- end
- protected
- def another_method
- c = 5
- end
- end
- output: |
- class Foo
- private
- def method
- b = 5
- end
- protected
- def another_method
- c = 5
- end
- end
-
- name: not treat divison as start of regex
input: |
def foo
View
4 Support/spec/rbeautify/block_matcher_spec.rb
@@ -59,8 +59,8 @@
end
it 'should remove two blocks if top of stack ends implicitly' do
- parent_block = RBeautify::BlockStart.new(@ruby.matcher(:standard), nil, 0, 0, 'class', ' Foo')
- child_block = RBeautify::BlockStart.new(@ruby.matcher(:implicit_end), parent_block, 0, 0, 'private', '')
+ parent_block = RBeautify::BlockStart.new(@ruby.matcher(:case), nil, 0, 0, 'case', ' foo')
+ child_block = RBeautify::BlockStart.new(@ruby.matcher(:inner_case), parent_block, 0, 0, 'when', '2')
RBeautify::BlockMatcher.parse(@ruby, child_block, 0, 'end', 0).should be_nil
end
end
View
28 Support/spec/rbeautify/config/ruby_spec.rb
@@ -119,34 +119,6 @@
it { @current_block.parse_block_end('#', 0).should be_nil }
end
- describe 'implicit_end' do
- before(:each) do
- @matcher = @ruby.matcher(:implicit_end)
- @current_block = RBeautify::BlockStart.new(@matcher, nil, 0, 0, '', '')
- end
-
- it { @matcher.should be_end_can_also_be_start}
-
- it { @matcher.parse_block_start('private', nil, 0, 0).should be_block_start_like(:implicit_end, 0, 'private', '') }
- it { @matcher.parse_block_start('protected', nil, 0, 0).should be_block_start_like(:implicit_end, 0, 'protected', '') }
- it { @matcher.parse_block_start('a = 3', nil, 0, 0).should be_nil }
-
- it { @current_block.parse_block_end('protected', 0).should be_block_end_like(@current_block, 0, 'protected', '') }
- it { @current_block.parse_block_end('protected # some comment', 0).should be_block_end_like(@current_block, 0, 'protected # some comment', '') }
- it { @current_block.parse_block_end('a = 3', 0).should be_nil }
-
- it 'should return both if implicit end from next block in stack' do
- surrounding_block = RBeautify::BlockStart.new(@ruby.matcher(:standard), nil, 0, 0, 'def', ' foo')
- current_block = RBeautify::BlockStart.new(@matcher, surrounding_block, 0, 0, '', '')
- current_block.parse_block_end('end', 0).should be_block_end_like(surrounding_block, 0, 'end', '')
- end
-
- it 'should return none if no implicit end from next block in stack' do
- surrounding_block = RBeautify::BlockStart.new(@ruby.matcher(:standard), nil, 0, 0, 'def', ' foo')
- @current_block.parse_block_end('a = 3', 0).should be_nil
- end
- end
-
describe 'round_bracket' do
before(:each) do
@matcher = @ruby.matcher(:round_bracket)

0 comments on commit f5efb16

Please sign in to comment.
Something went wrong with that request. Please try again.