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)



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

def self.primary_key_column
  "Constraint"
end

.table_nameObject



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

def self.table_name
  "t_constrainttypes"
end

Instance Method Details

#invariant?Boolean

Check if this is an invariant type

Returns:

  • (Boolean)


39
40
41
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 39

def invariant?
  constraint == "Invariant"
end

#nameString

Friendly name for constraint type

Returns:

  • (String)


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

def name
  constraint
end

#postcondition?Boolean

Check if this is a post-condition type

Returns:

  • (Boolean)


51
52
53
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 51

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

#precondition?Boolean

Check if this is a pre-condition type

Returns:

  • (Boolean)


45
46
47
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 45

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

#process?Boolean

Check if this is a process type

Returns:

  • (Boolean)


57
58
59
# File 'lib/lutaml/qea/models/ea_constraint_type.rb', line 57

def process?
  constraint == "Process"
end