Skip to content
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

Auto corrected by following Format Ruby Code #293

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/synvert/core/rewriter/instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ def wrap_with_quotes(str)
# @param tab_size [Integer] The number of spaces per tab.
# @return [String] The indented source code.
def indent(source, tab_size: 1)
source.each_line.map { |line| (' ' * NodeMutation.tab_width * tab_size) + line }.join
source.each_line.map { |line| (' ' * NodeMutation.tab_width * tab_size) + line }
.join
end

# Dedents the given source code by removing leading spaces or tabs.
Expand All @@ -467,7 +468,8 @@ def indent(source, tab_size: 1)
# @param tab_size [Integer] The number of spaces per tab (default is 1).
# @return [String] The dedented source code.
def dedent(source, tab_size: 1)
source.each_line.map { |line| line.sub(/^ {#{NodeMutation.tab_width * tab_size}}/, '') }.join
source.each_line.map { |line| line.sub(/^ {#{NodeMutation.tab_width * tab_size}}/, '') }
.join
end

private
Expand Down
Loading