Class: Suspenders::Actions::StripCommentsAction

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

Defined Under Namespace

Classes: BackwardStringScanner, StripComments, StripLeadingScopeNewlines

Class Method Summary collapse

Class Method Details

.call(source) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/suspenders/actions/strip_comments_action.rb', line 7

def call(source)
  parser = Parser::CurrentRuby.new

  source
    .then { |s| strip_comments(s, parser) }
    .then { |s| strip_trailing_whitespace(s) }
    .then { |s| strip_dup_newlines(s) }
    .then { |s| strip_leading_scope_newlines(s, parser) }
end