Class: Coradoc::AsciiDoc::Model::Term
- 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.
Instance Attribute Summary collapse
-
#lang ⇒ String
readonly
Language code (default: “en”).
-
#line_break ⇒ String
readonly
Line break character (default: “”).
-
#term ⇒ String
readonly
The term text being defined.
-
#type ⇒ String
readonly
The term type/category.
Attributes inherited from Base
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
#lang ⇒ String (readonly)
Returns 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_break ⇒ String (readonly)
Returns 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 |
#term ⇒ String (readonly)
Returns 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 |
#type ⇒ String (readonly)
Returns 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
#validate ⇒ Object
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 |