Class: Arrolio::Content::TermEntry
- Inherits:
-
Object
- Object
- Arrolio::Content::TermEntry
- Defined in:
- lib/arrolio/content/term_entry.rb
Overview
A dictionary term entry: optional number, preferred term text,
definition Paragraphs, and optional source citation. Maps to
the <term> element in standoc vocabulary. Renders as a
hanging-indent group in the flow builder.
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#preferred ⇒ Object
readonly
Returns the value of attribute preferred.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#style_id ⇒ Object
readonly
Returns the value of attribute style_id.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #empty? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(number: nil, preferred: nil, definition: [], source: nil, id: nil, style_id: :term) ⇒ TermEntry
constructor
A new instance of TermEntry.
Constructor Details
#initialize(number: nil, preferred: nil, definition: [], source: nil, id: nil, style_id: :term) ⇒ TermEntry
Returns a new instance of TermEntry.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/arrolio/content/term_entry.rb', line 12 def initialize(number: nil, preferred: nil, definition: [], source: nil, id: nil, style_id: :term) @number = number&.to_s @preferred = preferred @definition = Array(definition).freeze @source = source @id = id&.to_s @style_id = style_id.to_sym freeze end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
10 11 12 |
# File 'lib/arrolio/content/term_entry.rb', line 10 def definition @definition end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/arrolio/content/term_entry.rb', line 10 def id @id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
10 11 12 |
# File 'lib/arrolio/content/term_entry.rb', line 10 def number @number end |
#preferred ⇒ Object (readonly)
Returns the value of attribute preferred.
10 11 12 |
# File 'lib/arrolio/content/term_entry.rb', line 10 def preferred @preferred end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
10 11 12 |
# File 'lib/arrolio/content/term_entry.rb', line 10 def source @source end |
#style_id ⇒ Object (readonly)
Returns the value of attribute style_id.
10 11 12 |
# File 'lib/arrolio/content/term_entry.rb', line 10 def style_id @style_id end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
27 28 29 30 31 32 33 34 35 |
# File 'lib/arrolio/content/term_entry.rb', line 27 def ==(other) other.is_a?(self.class) && number == other.number && preferred == other.preferred && definition == other.definition && source == other.source && id == other.id && style_id == other.style_id end |
#empty? ⇒ Boolean
23 24 25 |
# File 'lib/arrolio/content/term_entry.rb', line 23 def empty? @preferred.nil? && @definition.empty? && @number.nil? end |
#hash ⇒ Object
38 39 40 |
# File 'lib/arrolio/content/term_entry.rb', line 38 def hash [self.class, number, preferred, definition, source, id, style_id].hash end |