Class: Linzer::Message::Field::Identifier Private

Inherits:
Struct
  • Object
show all
Includes:
IdentifierMethods
Defined in:
lib/linzer/message/field.rb,
lib/linzer/message/field.rb,
lib/linzer/message/field.rb,
lib/linzer/message/field/parser.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: Parser

Instance Attribute Summary collapse

Attributes included from IdentifierMethods

#item

Class Method Summary collapse

Methods included from IdentifierMethods

#derived?, #initialize, #serialize

Instance Attribute Details

#field_nameObject

Returns the value of attribute field_name

Returns:

  • (Object)

    the current value of field_name



49
50
51
# File 'lib/linzer/message/field.rb', line 49

def field_name
  @field_name
end

Class Method Details

.deserialize_components(components) ⇒ Array<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.

Deserializes component identifiers back to names.

Parameters:

  • components (Array<String>)

    Serialized identifiers

Returns:

  • (Array<String>)

    Component names



76
77
78
79
80
81
# File 'lib/linzer/message/field.rb', line 76

def deserialize_components(components)
  components.map do |c|
    item = Starry.parse_item(c)
    item.parameters.empty? ? item.value : Starry.serialize(item)
  end
end

.serialize(component) ⇒ 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 a single component identifier.

Parameters:

  • component (String)

    The component name

Returns:

  • (String)

    The serialized identifier



62
63
64
# File 'lib/linzer/message/field.rb', line 62

def serialize(component)
  new(field_name: component).serialize
end

.serialize_components(components) ⇒ Array<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 an array of component identifiers.

Parameters:

  • components (Array<String>)

    Component names

Returns:

  • (Array<String>)

    Serialized identifiers



69
70
71
# File 'lib/linzer/message/field.rb', line 69

def serialize_components(components)
  components.map(&method(:serialize))
end