Class: Lutaml::Qea::Models::EaComplexityType

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/lutaml/qea/models/ea_complexity_type.rb

Overview

Represents a complexity type definition from t_complexitytypes table

This table provides reference data for complexity levels that can be assigned to UML elements. Each complexity has a numeric weight for sorting/comparison.

Examples:

complexity_type = EaComplexityType.new
complexity_type.complexity #=> "High"
complexity_type.numeric_weight #=> 4

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

from_db_row, #primary_key

Class Method Details

.primary_key_columnObject

Primary key is Complexity (text)



25
26
27
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 25

def self.primary_key_column
  "Complexity"
end

.table_nameObject



20
21
22
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 20

def self.table_name
  "t_complexitytypes"
end

Instance Method Details

#<=>(other) ⇒ Integer

Compare complexity levels by numeric weight

Parameters:

Returns:

  • (Integer)

    -1, 0, or 1



71
72
73
74
75
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 71

def <=>(other)
  return 0 unless other.is_a?(EaComplexityType)

  weight <=> other.weight
end

#extreme?Boolean

Check if this is extreme complexity

Returns:

  • (Boolean)


64
65
66
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 64

def extreme?
  complexity == "Extreme"
end

#high?Boolean

Check if this is high complexity

Returns:

  • (Boolean)


58
59
60
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 58

def high?
  complexity&.match?(/^(V\.)?High$/i)
end

#low?Boolean

Check if this is low complexity

Returns:

  • (Boolean)


46
47
48
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 46

def low?
  complexity&.match?(/^(V\.)?Low$/i)
end

#medium?Boolean

Check if this is medium complexity

Returns:

  • (Boolean)


52
53
54
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 52

def medium?
  complexity == "Medium"
end

#nameString

Friendly name for complexity

Returns:

  • (String)


31
32
33
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 31

def name
  complexity
end

#weightInteger

Get numeric weight for sorting

Returns:

  • (Integer)


40
41
42
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 40

def weight
  numericweight || 0
end