-
Notifications
You must be signed in to change notification settings - Fork 98
♻️ Remove redundant return statements #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -566,7 +566,7 @@ def prefixes | |
| prefixes = [] | ||
| prefixes = parent.prefixes if parent | ||
| prefixes |= attributes.prefixes | ||
| return prefixes | ||
| prefixes | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -625,7 +625,7 @@ def namespace(prefix=nil) | |
| ns = namespaces[prefix] | ||
|
|
||
| ns = '' if ns.nil? and prefix == 'xmlns' | ||
| return ns | ||
| ns | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -957,7 +957,7 @@ def get_elements( xpath ) | |
| def next_element | ||
| element = next_sibling | ||
| element = element.next_sibling until element.nil? or element.kind_of? Element | ||
| return element | ||
| element | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -973,7 +973,7 @@ def next_element | |
| def previous_element | ||
| element = previous_sibling | ||
| element = element.previous_sibling until element.nil? or element.kind_of? Element | ||
| return element | ||
| element | ||
| end | ||
|
|
||
|
|
||
|
|
@@ -1023,8 +1023,7 @@ def has_text? | |
| # | ||
| def text( path = nil ) | ||
| rv = get_text(path) | ||
| return rv.value unless rv.nil? | ||
| nil | ||
| rv&.value | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -1052,7 +1051,7 @@ def get_text path = nil | |
| else | ||
| rv = @children.find { |node| node.kind_of? Text } | ||
| end | ||
| return rv | ||
| rv | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -1096,7 +1095,7 @@ def text=( text ) | |
| old_text.replace_with( text ) | ||
| end | ||
| end | ||
| return self | ||
| self | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -1147,7 +1146,7 @@ def add_text( text ) | |
| text = Text.new( text, whitespace(), nil, raw() ) | ||
| end | ||
| self << text unless text.nil? | ||
| return self | ||
| self | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -1191,7 +1190,7 @@ def xpath | |
| cur = cur.parent | ||
| path_elements << __to_xpath_helper( cur ) | ||
| end | ||
| return path_elements.reverse.join( "/" ) | ||
| path_elements.reverse.join( "/" ) | ||
| end | ||
|
|
||
| ################################################# | ||
|
|
@@ -1293,7 +1292,6 @@ def attribute( name, namespace=nil ) | |
| return nil unless ( namespaces[ prefix ] == namespaces[ 'xmlns' ] ) | ||
|
|
||
| attributes.get_attribute( name ) | ||
|
|
||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -1307,7 +1305,7 @@ def attribute( name, namespace=nil ) | |
| # b.has_attributes? # => false | ||
| # | ||
| def has_attributes? | ||
| return [email protected]? | ||
| [email protected]? | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -1685,11 +1683,7 @@ def []( index, name=nil) | |
| (num += 1) == index | ||
| } | ||
| else | ||
| return XPath::first( @element, index ) | ||
| #{ |element| | ||
| # return element if element.kind_of? Element | ||
| #} | ||
| #return nil | ||
| XPath::first( @element, index ) | ||
| end | ||
| end | ||
|
|
||
|
|
@@ -1736,7 +1730,7 @@ def []=( index, element ) | |
| else | ||
| previous.replace_with element | ||
| end | ||
| return previous | ||
| previous | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -1775,7 +1769,7 @@ def index element | |
| child == element | ||
| end | ||
| return rv if found == element | ||
| return -1 | ||
| -1 | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -1854,7 +1848,7 @@ def delete_all( xpath ) | |
| @element.delete element | ||
| element.remove | ||
| end | ||
| return rv | ||
| rv | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -2181,8 +2175,7 @@ def initialize element | |
| # | ||
| def [](name) | ||
| attr = get_attribute(name) | ||
| return attr.value unless attr.nil? | ||
| return nil | ||
| attr&.value | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -2337,7 +2330,7 @@ def get_attribute( name ) | |
| if attr.kind_of? Hash | ||
| attr = attr[ @element.prefix ] | ||
| end | ||
| return attr | ||
| attr | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -2390,7 +2383,7 @@ def []=( name, value ) | |
| else | ||
| store value.name, value | ||
| end | ||
| return @element | ||
| @element | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
@@ -2492,9 +2485,7 @@ def delete( attribute ) | |
| old.each_value{|v| repl = v} | ||
| store name, repl | ||
| end | ||
| elsif old.nil? | ||
| return @element | ||
| else # the supplied attribute is a top-level one | ||
| elsif old # the supplied attribute is a top-level one | ||
| super(name) | ||
| end | ||
| @element | ||
|
|
@@ -2548,7 +2539,7 @@ def delete_all( name ) | |
| rv << attribute if attribute.expanded_name == name | ||
| } | ||
| rv.each{ |attr| attr.remove } | ||
| return rv | ||
| rv | ||
| end | ||
|
|
||
| # :call-seq: | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.