Class: Templatecop::RubyClipper::TrailingDoRemover

Inherits:
Object
  • Object
show all
Defined in:
lib/templatecop/ruby_clipper.rb

Constant Summary collapse

REGEXP =
/
  [ \t]
  do
  [ \t]*
  (\|[^|]*\|)?
  [ \t]*
  \Z
/x.freeze

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ TrailingDoRemover

Returns a new instance of TrailingDoRemover.

Parameters:

  • code (String)


80
81
82
# File 'lib/templatecop/ruby_clipper.rb', line 80

def initialize(code)
  @code = code
end

Instance Method Details

#callHash

Returns:

  • (Hash)


85
86
87
88
89
90
# File 'lib/templatecop/ruby_clipper.rb', line 85

def call
  {
    code: @code.sub(REGEXP, ''),
    offset: 0
  }
end