Class: RBS::Inline::Annotator::Writer::InsertBefore
- Defined in:
- lib/rbs/inline/annotator/writer.rb
Instance Attribute Summary
Attributes inherited from Action
Instance Method Summary collapse
Methods inherited from Action
Constructor Details
This class inherits a constructor from RBS::Inline::Annotator::Writer::Action
Instance Method Details
#process(writer) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rbs/inline/annotator/writer.rb', line 20 def process(writer) if writer.before_pos < range.begin writer.slice << writer.source[writer.before_pos...range.begin] writer.before_pos = range.begin elsif writer.before_pos == range.begin # do nothing else raise "invalid range: #{range}, before_pos: #{writer.before_pos}" end writer.slice << text end |