Class: RuboCop::Erb::KeywordRemover::PrecedingSourceRemover
- Inherits:
-
Object
- Object
- RuboCop::Erb::KeywordRemover::PrecedingSourceRemover
show all
- Defined in:
- lib/rubocop/erb/keyword_remover.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PrecedingSourceRemover.
47
48
49
|
# File 'lib/rubocop/erb/keyword_remover.rb', line 47
def initialize(code)
@code = code
end
|
Class Method Details
41
42
43
|
# File 'lib/rubocop/erb/keyword_remover.rb', line 41
def call(code)
new(code).call
end
|
Instance Method Details
#call ⇒ Hash
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/rubocop/erb/keyword_remover.rb', line 52
def call
data = @code.match(self.class::REGEXP)
if data
offset = data[0].length
RubyClip.new(
code: @code[offset..],
offset: offset
)
else
RubyClip.new(
code: @code,
offset: 0
)
end
end
|