Class: Lutaml::Qea::Models::EaConstraintType

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

Overview

Represents a constraint type definition from t_constrainttypes table

This table provides reference data for constraint types used in OCL constraints. These are NOT instances of constraints, but the type definitions themselves (Invariant, Pre-condition, Post-condition, Process).

Examples:

constraint_type = EaConstraintType.new
constraint_type.constraint #=> "Invariant"
constraint_type.description #=> "A state the object must always..."

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 Constraint (text)



29
30
31
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 29

def self.primary_key_column
  "Constraint"
end

.table_nameObject



24
25
26
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 24

def self.table_name
  "t_constrainttypes"
end

Instance Method Details

#invariant?Boolean

Check if this is an invariant type

Returns:

  • (Boolean)


41
42
43
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 41

def invariant?
  constraint == "Invariant"
end

#nameString

Friendly name for constraint type

Returns:

  • (String)


35
36
37
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 35

def name
  constraint
end

#postcondition?Boolean

Check if this is a post-condition type

Returns:

  • (Boolean)


53
54
55
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 53

def postcondition?
  constraint == "Post-condition"
end

#precondition?Boolean

Check if this is a pre-condition type

Returns:

  • (Boolean)


47
48
49
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 47

def precondition?
  constraint == "Pre-condition"
end

#process?Boolean

Check if this is a process type

Returns:

  • (Boolean)


59
60
61
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 59

def process?
  constraint == "Process"
end