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)



27
28
29
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 27

def self.primary_key_column
  "Complexity"
end

.table_nameObject



22
23
24
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 22

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



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

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

  weight <=> other.weight
end

#extreme?Boolean

Check if this is extreme complexity

Returns:

  • (Boolean)


66
67
68
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 66

def extreme?
  complexity == "Extreme"
end

#high?Boolean

Check if this is high complexity

Returns:

  • (Boolean)


60
61
62
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 60

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

#low?Boolean

Check if this is low complexity

Returns:

  • (Boolean)


48
49
50
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 48

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

#medium?Boolean

Check if this is medium complexity

Returns:

  • (Boolean)


54
55
56
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 54

def medium?
  complexity == "Medium"
end

#nameString

Friendly name for complexity

Returns:

  • (String)


33
34
35
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 33

def name
  complexity
end

#weightInteger

Get numeric weight for sorting

Returns:

  • (Integer)


42
43
44
# File 'lib/lutaml/qea/models/ea_complexity_type.rb', line 42

def weight
  numericweight || 0
end