Class: Suspenders::Actions::StripCommentsAction::StripLeadingScopeNewlines::LeadingNewlineStripRewriter

Inherits:
Parser::TreeRewriter
  • Object
show all
Defined in:
lib/suspenders/actions/strip_comments_action.rb

Instance Method Summary collapse

Instance Method Details

#on_begin(node) ⇒ Object



162
163
164
165
166
# File 'lib/suspenders/actions/strip_comments_action.rb', line 162

def on_begin(node)
  handle_begin(node)

  super
end

#on_block(node) ⇒ Object



177
178
179
180
181
182
# File 'lib/suspenders/actions/strip_comments_action.rb', line 177

def on_block(node)
  strip_newline_before(node.children[2])
  strip_newline_after(node.children.last)

  super
end

#on_class(node) ⇒ Object



155
156
157
158
159
160
# File 'lib/suspenders/actions/strip_comments_action.rb', line 155

def on_class(node)
  strip_newline_before(node.children[2])
  strip_newline_after(node.children.last)

  super
end

#on_kwbegin(node) ⇒ Object



168
169
170
171
172
173
174
175
# File 'lib/suspenders/actions/strip_comments_action.rb', line 168

def on_kwbegin(node)
  strip_newline_before(node.children[0])
  strip_newline_after(node.children.last)

  handle_begin(node)

  super
end

#on_module(node) ⇒ Object



148
149
150
151
152
153
# File 'lib/suspenders/actions/strip_comments_action.rb', line 148

def on_module(node)
  strip_newline_before(node.children[1])
  strip_newline_after(node.children.last)

  super
end