Class: Coradoc::AsciiDoc::Model::Revision

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/asciidoc/model/revision.rb

Overview

Revision information for document headers.

Revision metadata tracks document version numbers, dates, and remarks.

Examples:

Create a revision

rev = Coradoc::AsciiDoc::Model::Revision.new
rev.number = "1.0"
rev.date = Date.new(2024, 1, 15)
rev.remark = "Initial release"

Raises:

  • (TypeError)

    if date is not a Date object

Instance Attribute Summary collapse

Attributes inherited from Base

#id

Instance Method Summary collapse

Methods inherited from Base

#block_level?, #inline?, #serialize_content, #simplify_block_content, #to_adoc, #to_h, visit, #visit

Instance Attribute Details

#dateDate? (readonly)

Returns The revision date.

Returns:

  • (Date, nil)

    The revision date



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/coradoc/asciidoc/model/revision.rb', line 27

class Revision < Base
  attribute :number, :string
  attribute :date, :date
  attribute :remark, :string

  def validate
    super
    validate_date_type
  end

  private

  def validate_date_type
    return if date.nil? || date.is_a?(Date)

    raise TypeError, "date must be a Date, got #{date.class}"
  end
end

#numberString? (readonly)

Returns The revision number (e.g., “1.0”, “2.1”).

Returns:

  • (String, nil)

    The revision number (e.g., “1.0”, “2.1”)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/coradoc/asciidoc/model/revision.rb', line 27

class Revision < Base
  attribute :number, :string
  attribute :date, :date
  attribute :remark, :string

  def validate
    super
    validate_date_type
  end

  private

  def validate_date_type
    return if date.nil? || date.is_a?(Date)

    raise TypeError, "date must be a Date, got #{date.class}"
  end
end

#remarkString? (readonly)

Returns Optional revision notes.

Returns:

  • (String, nil)

    Optional revision notes



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/coradoc/asciidoc/model/revision.rb', line 27

class Revision < Base
  attribute :number, :string
  attribute :date, :date
  attribute :remark, :string

  def validate
    super
    validate_date_type
  end

  private

  def validate_date_type
    return if date.nil? || date.is_a?(Date)

    raise TypeError, "date must be a Date, got #{date.class}"
  end
end

Instance Method Details

#validateObject



32
33
34
35
# File 'lib/coradoc/asciidoc/model/revision.rb', line 32

def validate
  super
  validate_date_type
end