Class: Ea::Sources::Qea::Xref::Record

Inherits:
Struct
  • Object
show all
Defined in:
lib/ea/sources/qea/xref/record.rb

Overview

Parsed t_xref.Description. Holds typed records for each block found in the source string. One Description can carry multiple records (e.g., several @PROP= blocks defining a stereotype's tagged-value set).

Consumers branch on record type without re-parsing strings.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecord

Returns a new instance of Record.



15
16
17
18
19
20
# File 'lib/ea/sources/qea/xref/record.rb', line 15

def initialize(*)
  super
  self.properties ||= []
  self.legends ||= []
  self.key_values ||= {}
end

Instance Attribute Details

#key_valuesObject

Returns the value of attribute key_values

Returns:

  • (Object)

    the current value of key_values



13
14
15
# File 'lib/ea/sources/qea/xref/record.rb', line 13

def key_values
  @key_values
end

#legendsObject

Returns the value of attribute legends

Returns:

  • (Object)

    the current value of legends



13
14
15
# File 'lib/ea/sources/qea/xref/record.rb', line 13

def legends
  @legends
end

#propertiesObject

Returns the value of attribute properties

Returns:

  • (Object)

    the current value of properties



13
14
15
# File 'lib/ea/sources/qea/xref/record.rb', line 13

def properties
  @properties
end

#rawObject

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



13
14
15
# File 'lib/ea/sources/qea/xref/record.rb', line 13

def raw
  @raw
end

#stereotypeObject

Returns the value of attribute stereotype

Returns:

  • (Object)

    the current value of stereotype



13
14
15
# File 'lib/ea/sources/qea/xref/record.rb', line 13

def stereotype
  @stereotype
end

Instance Method Details

#legend?Boolean

Returns true when at least one legend is present.

Returns:

  • (Boolean)

    true when at least one legend is present



28
29
30
# File 'lib/ea/sources/qea/xref/record.rb', line 28

def legend?
  !legends.empty?
end

#legend_titleString?

Convenience: first legend's name (the legend's title).

Returns:

  • (String, nil)


34
35
36
# File 'lib/ea/sources/qea/xref/record.rb', line 34

def legend_title
  legends.first&.name
end

#stereotype?Boolean

Returns true when a stereotype application is present.

Returns:

  • (Boolean)

    true when a stereotype application is present



23
24
25
# File 'lib/ea/sources/qea/xref/record.rb', line 23

def stereotype?
  !stereotype.nil?
end