Sha256: d7e1760bb745fe69e6ae9ce76c8a73ca55d4da622e52029c50c688d1b6cea5fd
Contents?: true
Size: 986 Bytes
Versions: 1
Compression:
Stored size: 986 Bytes
Contents
# frozen_string_literal: true module Tocer module Elements # Represents a table of contents start and finish comment block. class CommentBlock def self.index lines, id (lines.index { |line| line =~ /\<\!\-\-.*#{Regexp.escape id}.*\-\-\>/ }).to_i end def initialize start_id: "Tocer[start]", finish_id: "Tocer[finish]", message: "Auto-generated, don't remove." @start_id = start_id @finish_id = finish_id @message = message end def start comment start_id, message end def start_index lines self.class.index lines, start_id end def finish comment finish_id, message end def finish_index lines self.class.index lines, finish_id end private attr_reader :start_id, :finish_id, :message def comment id, message "<!-- #{id}: #{message} -->" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tocer-5.0.0 | lib/tocer/elements/comment_block.rb |