Class: Diagrams::Elements::ERDRelationship
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Diagrams::Elements::ERDRelationship
- Includes:
- Types
- Defined in:
- lib/diagrams/elements/erd_relationship.rb
Overview
Represents a relationship between two entities in an ER Diagram.
Constant Summary collapse
- CARDINALITY =
Cardinality symbols (Crow’s Foot notation mapping)
Types::Strict::Symbol.enum( :ZERO_OR_ONE, # |o :ONE_ONLY, # || :ZERO_OR_MORE, # }o :ONE_OR_MORE # }| )
Instance Method Summary collapse
-
#to_h ⇒ Hash{Symbol => String | Symbol | Bool}
Returns a hash representation suitable for serialization.
Instance Method Details
#to_h ⇒ Hash{Symbol => String | Symbol | Bool}
Returns a hash representation suitable for serialization.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/diagrams/elements/erd_relationship.rb', line 27 def to_h hash = { entity1: entity1, entity2: entity2, cardinality1: cardinality1.to_s, # Convert symbol to string cardinality2: cardinality2.to_s, # Convert symbol to string identifying: } hash[:label] = label if label hash end |