This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 1
1
### Development (unreleased)
2
2
3
3
Breaking Changes:
4
-
5
4
* Ruby < 2.3 is no longer supported. (Phil Pirozhkov, #436 )
6
5
7
6
Bug Fixes:
8
7
* Use ` Mutex#owned? ` to allow ` RSpec::Support::ReentrantMutex ` to work in
9
8
nested Fibers on Ruby 3.0 and later. (Benoit Daloze, #503 )
9
+ * Support ` end ` -less methods in ` RSpec::Support::Source::Token `
10
+ so that RSpec won't hang when an ` end ` -less method raises an error. (Yuji Nakayama, #505 )
10
11
11
12
### 3.10.0 / 2020-10-30
12
13
Original file line number Diff line number Diff line change @@ -54,12 +54,16 @@ def keyword?
54
54
type == :on_kw
55
55
end
56
56
57
+ def equals_operator?
58
+ type == :on_op && string == '='
59
+ end
60
+
57
61
def opening?
58
62
opening_delimiter? || opening_keyword?
59
63
end
60
64
61
65
def closed_by? ( other )
62
- closed_by_delimiter ?( other ) || closed_by_keyword ?( other )
66
+ delimiter_closed_by ?( other ) || keyword_closed_by ?( other )
63
67
end
64
68
65
69
private
@@ -73,13 +77,16 @@ def opening_keyword?
73
77
CLOSING_KEYWORDS_BY_OPENING_KEYWORD . key? ( string )
74
78
end
75
79
76
- def closed_by_delimiter ?( other )
80
+ def delimiter_closed_by ?( other )
77
81
other . type == CLOSING_TYPES_BY_OPENING_TYPE [ type ]
78
82
end
79
83
80
- def closed_by_keyword? ( other )
81
- return false unless other . keyword?
82
- other . string == CLOSING_KEYWORDS_BY_OPENING_KEYWORD [ string ]
84
+ def keyword_closed_by? ( other )
85
+ return false unless keyword?
86
+ return true if other . string == CLOSING_KEYWORDS_BY_OPENING_KEYWORD [ string ]
87
+
88
+ # Ruby 3's `end`-less method definition: `def method_name = body`
89
+ string == 'def' && other . equals_operator? && location . line == other . location . line
83
90
end
84
91
end
85
92
end
You can’t perform that action at this time.
0 commit comments