Class: Diagrams::Elements::ERDAttribute

Inherits:
Dry::Struct
  • Object
show all
Includes:
Types
Defined in:
lib/diagrams/elements/erd_attribute.rb

Overview

Represents an attribute within an ERD entity.

Instance Method Summary collapse

Instance Method Details

#to_hHash{Symbol => String | Array<Symbol>}

Returns a hash representation suitable for serialization.

Returns:

  • (Hash{Symbol => String | Array<Symbol>})


17
18
19
20
21
22
23
24
25
# File 'lib/diagrams/elements/erd_attribute.rb', line 17

def to_h
  hash = {
    type:,
    name:,
    keys: keys.map(&:to_s) # Convert symbols to strings for serialization
  }
  hash[:comment] = comment if comment
  hash
end