Class: Diagrams::Elements::GitCommit
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Diagrams::Elements::GitCommit
- Includes:
- Types
- Defined in:
- lib/diagrams/elements/git_commit.rb
Overview
Represents a commit in a Gitgraph diagram.
Instance Method Summary collapse
-
#to_h ⇒ Hash{Symbol => String | Array<String> | Symbol}
Returns a hash representation suitable for serialization.
Instance Method Details
#to_h ⇒ Hash{Symbol => String | Array<String> | Symbol}
Returns a hash representation suitable for serialization. Optional attributes are included only if they have non-nil values.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/diagrams/elements/git_commit.rb', line 21 def to_h hash = { id:, parent_ids:, branch_name:, type: } hash[:message] = if hash[:tag] = tag if tag hash[:cherry_pick_source_id] = cherry_pick_source_id if cherry_pick_source_id hash end |