Module: Linzer::Message::Field::IdentifierMethods Private
- Included in:
- Identifier
- Defined in:
- lib/linzer/message/field.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Methods mixed into the Identifier class for field name handling.
Instance Attribute Summary collapse
-
#item ⇒ Starry::Item?
readonly
private
The parsed structured field item.
Instance Method Summary collapse
-
#derived? ⇒ Boolean
private
Checks if this is a derived component (starts with @).
-
#initialize(field_name:) ⇒ Object
private
Initializes the identifier by parsing the field name.
-
#serialize ⇒ String
private
Serializes the component identifier.
Instance Attribute Details
#item ⇒ Starry::Item? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The parsed structured field item.
24 25 26 |
# File 'lib/linzer/message/field.rb', line 24 def item @item end |
Instance Method Details
#derived? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Checks if this is a derived component (starts with @).
28 29 30 |
# File 'lib/linzer/message/field.rb', line 28 def derived? item&.value&.start_with?("@") end |
#initialize(field_name:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the identifier by parsing the field name.
18 19 20 21 |
# File 'lib/linzer/message/field.rb', line 18 def initialize(field_name:) @item = Identifier::Parser.parse(field_name) rescue nil super end |
#serialize ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Serializes the component identifier.
35 36 37 38 |
# File 'lib/linzer/message/field.rb', line 35 def serialize raise Error, "Invalid component identifier: '#{field_name}'!" unless item Starry.serialize(@item) end |