-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix arguments in method defifinition with parentheses. Add support fo…
…r multiline arguments in method definition without parentheses. Add support for double splat operator.
- Loading branch information
1 parent
02613b0
commit 9b41083
Showing
2 changed files
with
161 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
def method; hello, world = [1,2] end # test comment | ||
|
||
def method_with_parentheses(a, b, c = [foo,bar,baz]); hello, world = [1,2] end # test comment | ||
|
||
def method_without_parentheses a, b, c = [foo,bar,baz]; hello, world = [1,2] end # test comment | ||
|
||
def method # test comment | ||
hello, world = [1,2] | ||
end | ||
|
||
def method_with_parentheses(a, b, c = [foo,bar,baz]) # test comment | ||
hello, world = [1,2] | ||
end | ||
|
||
def method_without_parentheses a, b, c = [foo,bar,baz] # test comment | ||
hello, world = [1,2] | ||
end | ||
|
||
def method_with_parentheses(a, b = "hello", c = ["foo", "bar"], d = (2 + 2) * 2, e = {}) # test comment | ||
hello, world = [1,2] | ||
do_something1 | ||
do_something2 | ||
end | ||
|
||
def method_without_parentheses a, b = "hello", c = ["foo", "bar"], d = (2 + 2) * 2, e = "" # test comment | ||
hello, world = [1,2] | ||
do_something1 | ||
do_something2 | ||
end | ||
|
||
def method_with_parentheses(a, | ||
b = hello, # test comment | ||
c = ["foo", bar, :baz], | ||
d = (2 + 2) * 2, | ||
e = {}) | ||
hello, world = [1,2] | ||
do_something1 | ||
do_something2 | ||
end | ||
|
||
def method_without_parentheses a, | ||
b = "hello" , # test comment | ||
c = ["foo", bar, :baz], | ||
d = (2 + 2) * 2, | ||
e = proc { |e| e + e } | ||
hello, world = [1,2] | ||
do_something1 | ||
do_something2 | ||
end | ||
|
||
def method_without_parentheses a, | ||
b: hello , # test comment | ||
c: ["foo", bar, :baz], | ||
d: (2 + 2) * 2, | ||
e: proc { |e| e + e } | ||
hello, world = [1,2] | ||
do_something1 | ||
do_something2 | ||
end | ||
|
||
# double splat, splat, and & opearator | ||
def method_with_parentheses(*a, **b, &c); hello, world = [1,2] end # test comment | ||
|
||
def method_without_parentheses *a, **b, &c; hello, world = [1,2] end # test comment | ||
|
||
def method_with_parentheses(*a, **b, &c) # test comment | ||
hello, world = [1,2] | ||
end | ||
|
||
def method_without_parentheses *a, **b, &c # test comment | ||
hello, world = [1,2] | ||
end |