Class: Coradoc::AsciiDoc::Model::Term

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

Overview

Term element for AsciiDoc definition lists.

Terms are the items being defined in definition lists. Each term has a text value and can have an optional type.

Examples:

Create a term

term = Coradoc::AsciiDoc::Model::Term.new
term.term = "ASCII"
term.type = "acronym"

See Also:

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

#langString (readonly)

Returns Language code (default: “en”).

Returns:

  • (String)

    Language code (default: “en”)



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

class Term < Base
  attribute :term, :string
  attribute :type, :string
  attribute :lang, :string, default: -> { 'en' }
  attribute :line_break, :string, default: -> { '' }

  def validate
    errors = super

    errors << Lutaml::Model::Error.new('Term cannot be nil or empty') if term.nil? || term.empty?

    errors << Lutaml::Model::Error.new('Type cannot be nil or empty') if type.nil? || type.empty?

    errors
  end
end

#line_breakString (readonly)

Returns Line break character (default: “”).

Returns:

  • (String)

    Line break character (default: “”)



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

class Term < Base
  attribute :term, :string
  attribute :type, :string
  attribute :lang, :string, default: -> { 'en' }
  attribute :line_break, :string, default: -> { '' }

  def validate
    errors = super

    errors << Lutaml::Model::Error.new('Term cannot be nil or empty') if term.nil? || term.empty?

    errors << Lutaml::Model::Error.new('Type cannot be nil or empty') if type.nil? || type.empty?

    errors
  end
end

#termString (readonly)

Returns The term text being defined.

Returns:

  • (String)

    The term text being defined



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

class Term < Base
  attribute :term, :string
  attribute :type, :string
  attribute :lang, :string, default: -> { 'en' }
  attribute :line_break, :string, default: -> { '' }

  def validate
    errors = super

    errors << Lutaml::Model::Error.new('Term cannot be nil or empty') if term.nil? || term.empty?

    errors << Lutaml::Model::Error.new('Type cannot be nil or empty') if type.nil? || type.empty?

    errors
  end
end

#typeString (readonly)

Returns The term type/category.

Returns:

  • (String)

    The term type/category



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

class Term < Base
  attribute :term, :string
  attribute :type, :string
  attribute :lang, :string, default: -> { 'en' }
  attribute :line_break, :string, default: -> { '' }

  def validate
    errors = super

    errors << Lutaml::Model::Error.new('Term cannot be nil or empty') if term.nil? || term.empty?

    errors << Lutaml::Model::Error.new('Type cannot be nil or empty') if type.nil? || type.empty?

    errors
  end
end

Instance Method Details

#validateObject



36
37
38
39
40
41
42
43
44
# File 'lib/coradoc/asciidoc/model/term.rb', line 36

def validate
  errors = super

  errors << Lutaml::Model::Error.new('Term cannot be nil or empty') if term.nil? || term.empty?

  errors << Lutaml::Model::Error.new('Type cannot be nil or empty') if type.nil? || type.empty?

  errors
end