Sha256: 00a36168cfb2be1cdb0ef2cf812f8399ff66e698d03c183e136557aaf26d64a2

Contents?: true

Size: 589 Bytes

Versions: 11

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module Doing
  # Section Object
  class Section
    attr_accessor :original, :title

    def initialize(title, original: nil)
      super()

      @title = title

      @original = if original.nil?
                    "#{title}:"
                  else
                    original =~ /:(\s+@[^ (]+(\([^)]*\))?)*?$/ ? original : "#{original}:"
                  end
    end

    # Outputs section title
    def to_s
      @title
    end

    # @private
    def inspect
      %(#<Doing::Section @title="#{@title}" @original="#{@original}">)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
doing-2.1.40 lib/doing/section.rb
doing-2.1.39 lib/doing/section.rb
doing-2.1.38 lib/doing/section.rb
doing-2.1.37 lib/doing/section.rb
doing-2.1.36 lib/doing/section.rb
doing-2.1.35 lib/doing/section.rb
doing-2.1.34 lib/doing/section.rb
doing-2.1.33 lib/doing/section.rb
doing-2.1.32 lib/doing/section.rb
doing-2.1.31pre lib/doing/section.rb
doing-2.1.30 lib/doing/section.rb