Sha256: 5b8e03c6e9de7fc2b85a8e19906077053ba3cc4c876256c49b77be73bf7d3c93
Contents?: true
Size: 908 Bytes
Versions: 2
Compression:
Stored size: 908 Bytes
Contents
module Tocer module Elements # Represents a table of contents start and finish comment block. class CommentBlock 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 collection index collection, start_id end def finish comment finish_id, message end def finish_index collection index collection, finish_id end private attr_reader :start_id, :finish_id, :message def comment id, message "<!-- #{id}: #{message} -->" end def index collection, id collection.index { |line| line =~ /\<\!\-\-.*#{Regexp.escape id}.*\-\-\>/ } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tocer-2.0.0 | lib/tocer/elements/comment_block.rb |
tocer-1.0.0 | lib/tocer/elements/comment_block.rb |