mermaid 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +116 -12
  4. data/Rakefile +2 -2
  5. data/lib/mermaid/class_diagram_renderer.rb +45 -0
  6. data/lib/mermaid/element_renderers/edge_renderer.rb +19 -0
  7. data/lib/mermaid/element_renderers/node_renderer.rb +16 -0
  8. data/lib/mermaid/element_renderers/relationship_renderer.rb +24 -0
  9. data/lib/mermaid/element_renderers/slice_renderer.rb +16 -0
  10. data/lib/mermaid/element_renderers/state_renderer.rb +15 -0
  11. data/lib/mermaid/element_renderers/task_renderer.rb +15 -0
  12. data/lib/mermaid/element_renderers/transition_renderer.rb +17 -0
  13. data/lib/mermaid/flowchart_diagram_renderer.rb +23 -0
  14. data/lib/mermaid/gantt_diagram_renderer.rb +16 -0
  15. data/lib/mermaid/gitgraph_diagram_renderer.rb +113 -0
  16. data/lib/mermaid/pie_diagram_renderer.rb +16 -0
  17. data/lib/mermaid/state_diagram_renderer.rb +42 -0
  18. data/lib/mermaid/timeline_diagram_renderer.rb +29 -0
  19. data/lib/mermaid/version.rb +1 -1
  20. data/lib/mermaid.rb +20 -10
  21. data/sig/diagrams/base.rbs +8 -0
  22. data/sig/diagrams/class_diagram.rbs +18 -0
  23. data/sig/diagrams/elements/edge.rbs +16 -0
  24. data/sig/diagrams/elements/node.rbs +15 -0
  25. data/sig/diagrams/elements/relationship.rbs +17 -0
  26. data/sig/diagrams/elements/slice.rbs +16 -0
  27. data/sig/diagrams/elements/state.rbs +15 -0
  28. data/sig/diagrams/elements/task.rbs +17 -0
  29. data/sig/diagrams/elements/transition.rbs +16 -0
  30. data/sig/diagrams/flowchart_diagram.rbs +14 -0
  31. data/sig/diagrams/gantt_diagram.rbs +14 -0
  32. data/sig/diagrams/pie_diagram.rbs +14 -0
  33. data/sig/diagrams/state_diagram.rbs +18 -0
  34. data/sig/mermaid/base_diagram.rbs +31 -0
  35. data/sig/mermaid/state_diagram.rbs +26 -0
  36. metadata +168 -35
  37. data/lib/mermaid/base_diagram.rb +0 -13
  38. data/lib/mermaid/c4_diagram.rb +0 -9
  39. data/lib/mermaid/class_diagram.rb +0 -10
  40. data/lib/mermaid/er_diagram.rb +0 -9
  41. data/lib/mermaid/flowchart_diagram/link.rb +0 -46
  42. data/lib/mermaid/flowchart_diagram/node.rb +0 -36
  43. data/lib/mermaid/flowchart_diagram/parser.rb +0 -30
  44. data/lib/mermaid/flowchart_diagram.rb +0 -32
  45. data/lib/mermaid/gantt_diagram.rb +0 -9
  46. data/lib/mermaid/git_graph_diagram.rb +0 -9
  47. data/lib/mermaid/info_flow_diagram.rb +0 -9
  48. data/lib/mermaid/mindmap_diagram.rb +0 -9
  49. data/lib/mermaid/pie_diagram.rb +0 -9
  50. data/lib/mermaid/quadrant_diagram.rb +0 -10
  51. data/lib/mermaid/requirement_diagram.rb +0 -9
  52. data/lib/mermaid/sankey_diagram.rb +0 -9
  53. data/lib/mermaid/sequence_diagram.rb +0 -9
  54. data/lib/mermaid/state_diagram.rb +0 -9
  55. data/lib/mermaid/user_journey_diagram.rb +0 -10
  56. data/lib/mermaid/xy_diagram.rb +0 -10
@@ -0,0 +1,8 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's base class
2
+ module Diagrams
3
+ class Base
4
+ # Added by mermaid-ruby gem
5
+ # Generates the Mermaid syntax representation of the diagram.
6
+ def to_mermaid: () -> String
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's ClassDiagram class
2
+ module Diagrams
3
+ class ClassDiagram < Base
4
+ # Added by mermaid-ruby gem
5
+ # Generates the Mermaid syntax for the class diagram.
6
+ def to_mermaid: () -> String
7
+
8
+ # Original methods from diagram gem (if known/needed for context)
9
+ # attr_reader classes: Array[Elements::ClassEntity]
10
+ # attr_reader relationships: Array[Elements::Relationship]
11
+ # def initialize: (classes: Array[Elements::ClassEntity], relationships: Array[Elements::Relationship], ?version: untyped) -> void
12
+ # ... other methods ...
13
+
14
+ # Patched private method (optional to include in RBS)
15
+ # private
16
+ # def format_class_entity: (Elements::ClassEntity) -> String
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's Edge element class
2
+ module Diagrams
3
+ module Elements
4
+ class Edge < Dry::Struct
5
+ # Added by mermaid-ruby gem
6
+ # Generates the Mermaid fragment for a flowchart edge.
7
+ def to_mermaid_fragment: () -> String
8
+
9
+ # Original attributes/methods (if known/needed)
10
+ # attr_reader source_id: String
11
+ # attr_reader target_id: String
12
+ # attr_reader label: String?
13
+ # ...
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's Node element class
2
+ module Diagrams
3
+ module Elements
4
+ class Node < Dry::Struct
5
+ # Added by mermaid-ruby gem
6
+ # Generates the Mermaid fragment for a flowchart node.
7
+ def to_mermaid_fragment: () -> String
8
+
9
+ # Original attributes/methods (if known/needed)
10
+ # attr_reader id: String
11
+ # attr_reader label: String
12
+ # ...
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's Relationship element class
2
+ module Diagrams
3
+ module Elements
4
+ class Relationship < Dry::Struct
5
+ # Added by mermaid-ruby gem
6
+ # Generates the Mermaid fragment for a relationship.
7
+ def to_mermaid_fragment: () -> String
8
+
9
+ # Original attributes/methods (if known/needed)
10
+ # attr_reader source_class_name: String
11
+ # attr_reader target_class_name: String
12
+ # attr_reader type: String
13
+ # attr_reader label: String?
14
+ # ...
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's Slice element class
2
+ module Diagrams
3
+ module Elements
4
+ class Slice < Dry::Struct
5
+ # Added by mermaid-ruby gem
6
+ # Generates the Mermaid fragment for a pie chart slice.
7
+ def to_mermaid_fragment: () -> String
8
+
9
+ # Original attributes/methods (if known/needed)
10
+ # attr_reader label: String
11
+ # attr_reader value: Float
12
+ # attr_reader percentage: Float?
13
+ # ...
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's State element class
2
+ module Diagrams
3
+ module Elements
4
+ class State < Dry::Struct
5
+ # Added by mermaid-ruby gem
6
+ # Generates the Mermaid fragment for a state definition.
7
+ def to_mermaid_fragment: () -> String
8
+
9
+ # Original attributes/methods (if known/needed)
10
+ # attr_reader id: String
11
+ # attr_reader label: String?
12
+ # ...
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's Task element class
2
+ module Diagrams
3
+ module Elements
4
+ class Task < Dry::Struct
5
+ # Added by mermaid-ruby gem
6
+ # Generates the Mermaid fragment for a Gantt task.
7
+ def to_mermaid_fragment: () -> String
8
+
9
+ # Original attributes/methods (if known/needed)
10
+ # attr_reader id: String
11
+ # attr_reader name: String
12
+ # attr_reader start_date: String
13
+ # attr_reader end_date: String
14
+ # ...
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's Transition element class
2
+ module Diagrams
3
+ module Elements
4
+ class Transition < Dry::Struct
5
+ # Added by mermaid-ruby gem
6
+ # Generates the Mermaid fragment for a transition.
7
+ def to_mermaid_fragment: () -> String
8
+
9
+ # Original attributes/methods (if known/needed)
10
+ # attr_reader source_state_id: String
11
+ # attr_reader target_state_id: String
12
+ # attr_reader label: String?
13
+ # ...
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's FlowchartDiagram class
2
+ module Diagrams
3
+ class FlowchartDiagram < Base
4
+ # Added by mermaid-ruby gem
5
+ # Generates the Mermaid syntax for the flowchart diagram.
6
+ def to_mermaid: () -> String
7
+
8
+ # Original methods from diagram gem (if known/needed for context)
9
+ # attr_reader nodes: Array[Elements::Node]
10
+ # attr_reader edges: Array[Elements::Edge]
11
+ # def initialize: (nodes: Array[Elements::Node], edges: Array[Elements::Edge], ?version: untyped) -> void
12
+ # ... other methods ...
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's GanttDiagram class
2
+ module Diagrams
3
+ class GanttDiagram < Base
4
+ # Added by mermaid-ruby gem
5
+ # Generates the Mermaid syntax for the Gantt chart.
6
+ def to_mermaid: () -> String
7
+
8
+ # Original methods from diagram gem (if known/needed for context)
9
+ # attr_reader title: String
10
+ # attr_reader tasks: Array[Elements::Task]
11
+ # def initialize: (?title: String, ?tasks: Array[Elements::Task], ?version: untyped) -> void
12
+ # ... other methods ...
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's PieDiagram class
2
+ module Diagrams
3
+ class PieDiagram < Base
4
+ # Added by mermaid-ruby gem
5
+ # Generates the Mermaid syntax for the pie chart.
6
+ def to_mermaid: () -> String
7
+
8
+ # Original methods from diagram gem (if known/needed for context)
9
+ # attr_reader title: String
10
+ # attr_reader slices: Array[Elements::Slice]
11
+ # def initialize: (?title: String, ?slices: Array[Elements::Slice], ?version: untyped) -> void
12
+ # ... other methods ...
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ # RBS signatures for patches applied to the 'diagram' gem's StateDiagram class
2
+ module Diagrams
3
+ class StateDiagram < Base
4
+ # Added by mermaid-ruby gem
5
+ # Generates the Mermaid syntax for the state diagram.
6
+ def to_mermaid: () -> String
7
+
8
+ # Original methods from diagram gem (if known/needed for context)
9
+ # attr_reader states: Array[Elements::State]
10
+ # attr_reader transitions: Array[Elements::Transition]
11
+ # def initialize: (states: Array[Elements::State], transitions: Array[Elements::Transition], ?version: untyped) -> void
12
+ # ... other methods ...
13
+
14
+ # Patched private method (optional to include in RBS)
15
+ # private
16
+ # def validate_elements!: () -> void
17
+ end
18
+ end
@@ -0,0 +1,31 @@
1
+ module Mermaid
2
+ # Abstract base class for all diagram types.
3
+ # Subclasses should inherit from this and implement required methods.
4
+ class BaseDiagram < ::Dry::Struct
5
+ # Placeholder for Dry.Types module if needed within RBS
6
+ module Types
7
+ # Define types used in attributes if necessary
8
+ end
9
+
10
+ # Converts the diagram's specific data to a hash.
11
+ # Subclasses must implement this.
12
+ # @raise [NotImplementedError]
13
+ # @return [Hash]
14
+ def to_hash: () -> Hash[untyped, untyped]
15
+
16
+ # Generates the Mermaid syntax representation of the diagram.
17
+ # Subclasses must override this method.
18
+ # @raise [NotImplementedError]
19
+ # @return [String]
20
+ def to_mermaid: () -> String
21
+
22
+ # Generates the Mermaid syntax representation.
23
+ # @deprecated Use #to_mermaid instead.
24
+ # @return [String]
25
+ def to_s: () -> String
26
+
27
+ # Potentially add `generate` if it was meant to be public,
28
+ # otherwise assume it's an internal detail called by `to_s`/`to_mermaid`.
29
+ # def generate: () -> String
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ module Mermaid
2
+ class StateDiagram < BaseDiagram
3
+ KEYWORD: String
4
+
5
+ # Define types for attributes if not already globally available
6
+ # Assuming State and Transition types are defined elsewhere or inferred
7
+ # If State and Transition have their own RBS files, they should be referenced.
8
+ # Example:
9
+ # type state = StateDiagram::State
10
+ # type transition = StateDiagram::Transition
11
+
12
+ attr_reader id: String
13
+ attr_reader states: Array[StateDiagram::State] # Assuming State is defined
14
+ attr_reader transitions: Array[StateDiagram::Transition] # Assuming Transition is defined
15
+
16
+ # @deprecated Use #to_mermaid instead.
17
+ def generate: () -> String
18
+
19
+ # Generates the Mermaid syntax for the state diagram.
20
+ # @return [String]
21
+ def to_mermaid: () -> String
22
+
23
+ # Need RBS definitions for State and Transition classes as well
24
+ # in sig/mermaid/state_diagram/state.rbs and sig/mermaid/state_diagram/transition.rbs
25
+ end
26
+ end
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mermaid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-24 00:00:00.000000000 Z
10
+ date: 2025-04-01 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: diagram
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 0.3.2
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.3.2
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: zeitwerk
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -25,33 +38,145 @@ dependencies:
25
38
  - !ruby/object:Gem::Version
26
39
  version: '0'
27
40
  - !ruby/object:Gem::Dependency
28
- name: dry-types
41
+ name: capybara
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: cuprite
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: minitest
29
70
  requirement: !ruby/object:Gem::Requirement
30
71
  requirements:
31
72
  - - "~>"
32
73
  - !ruby/object:Gem::Version
33
- version: '1.7'
34
- type: :runtime
74
+ version: '5.0'
75
+ type: :development
35
76
  prerelease: false
36
77
  version_requirements: !ruby/object:Gem::Requirement
37
78
  requirements:
38
79
  - - "~>"
39
80
  - !ruby/object:Gem::Version
40
- version: '1.7'
81
+ version: '5.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: minitest-reporters
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
41
96
  - !ruby/object:Gem::Dependency
42
- name: dry-struct
97
+ name: rubocop
43
98
  requirement: !ruby/object:Gem::Requirement
44
99
  requirements:
45
100
  - - "~>"
46
101
  - !ruby/object:Gem::Version
47
- version: '1.6'
48
- type: :runtime
102
+ version: '1.59'
103
+ type: :development
49
104
  prerelease: false
50
105
  version_requirements: !ruby/object:Gem::Requirement
51
106
  requirements:
52
107
  - - "~>"
53
108
  - !ruby/object:Gem::Version
54
- version: '1.6'
109
+ version: '1.59'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rubocop-minitest
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.34'
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.34'
124
+ - !ruby/object:Gem::Dependency
125
+ name: rubocop-performance
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.20'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '1.20'
138
+ - !ruby/object:Gem::Dependency
139
+ name: rubocop-rake
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '0.6'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '0.6'
152
+ - !ruby/object:Gem::Dependency
153
+ name: simplecov
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ - !ruby/object:Gem::Dependency
167
+ name: steep
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ type: :development
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
55
180
  description: Generate Diagrams and Flowcharts with Mermaid
56
181
  email:
57
182
  - terminale@gmail.com
@@ -64,27 +189,36 @@ files:
64
189
  - README.md
65
190
  - Rakefile
66
191
  - lib/mermaid.rb
67
- - lib/mermaid/base_diagram.rb
68
- - lib/mermaid/c4_diagram.rb
69
- - lib/mermaid/class_diagram.rb
70
- - lib/mermaid/er_diagram.rb
71
- - lib/mermaid/flowchart_diagram.rb
72
- - lib/mermaid/flowchart_diagram/link.rb
73
- - lib/mermaid/flowchart_diagram/node.rb
74
- - lib/mermaid/flowchart_diagram/parser.rb
75
- - lib/mermaid/gantt_diagram.rb
76
- - lib/mermaid/git_graph_diagram.rb
77
- - lib/mermaid/info_flow_diagram.rb
78
- - lib/mermaid/mindmap_diagram.rb
79
- - lib/mermaid/pie_diagram.rb
80
- - lib/mermaid/quadrant_diagram.rb
81
- - lib/mermaid/requirement_diagram.rb
82
- - lib/mermaid/sankey_diagram.rb
83
- - lib/mermaid/sequence_diagram.rb
84
- - lib/mermaid/state_diagram.rb
85
- - lib/mermaid/user_journey_diagram.rb
192
+ - lib/mermaid/class_diagram_renderer.rb
193
+ - lib/mermaid/element_renderers/edge_renderer.rb
194
+ - lib/mermaid/element_renderers/node_renderer.rb
195
+ - lib/mermaid/element_renderers/relationship_renderer.rb
196
+ - lib/mermaid/element_renderers/slice_renderer.rb
197
+ - lib/mermaid/element_renderers/state_renderer.rb
198
+ - lib/mermaid/element_renderers/task_renderer.rb
199
+ - lib/mermaid/element_renderers/transition_renderer.rb
200
+ - lib/mermaid/flowchart_diagram_renderer.rb
201
+ - lib/mermaid/gantt_diagram_renderer.rb
202
+ - lib/mermaid/gitgraph_diagram_renderer.rb
203
+ - lib/mermaid/pie_diagram_renderer.rb
204
+ - lib/mermaid/state_diagram_renderer.rb
205
+ - lib/mermaid/timeline_diagram_renderer.rb
86
206
  - lib/mermaid/version.rb
87
- - lib/mermaid/xy_diagram.rb
207
+ - sig/diagrams/base.rbs
208
+ - sig/diagrams/class_diagram.rbs
209
+ - sig/diagrams/elements/edge.rbs
210
+ - sig/diagrams/elements/node.rbs
211
+ - sig/diagrams/elements/relationship.rbs
212
+ - sig/diagrams/elements/slice.rbs
213
+ - sig/diagrams/elements/state.rbs
214
+ - sig/diagrams/elements/task.rbs
215
+ - sig/diagrams/elements/transition.rbs
216
+ - sig/diagrams/flowchart_diagram.rbs
217
+ - sig/diagrams/gantt_diagram.rbs
218
+ - sig/diagrams/pie_diagram.rbs
219
+ - sig/diagrams/state_diagram.rbs
220
+ - sig/mermaid/base_diagram.rbs
221
+ - sig/mermaid/state_diagram.rbs
88
222
  homepage: https://github.com/seuros/mermaid-ruby
89
223
  licenses:
90
224
  - MIT
@@ -92,7 +226,7 @@ metadata:
92
226
  homepage_uri: https://github.com/seuros/mermaid-ruby
93
227
  source_code_uri: https://github.com/seuros/mermaid-ruby
94
228
  changelog_uri: https://github.com/seuros/mermaid-ruby/blob/master/CHANGELOG.md
95
- post_install_message:
229
+ rubygems_mfa_required: 'true'
96
230
  rdoc_options: []
97
231
  require_paths:
98
232
  - lib
@@ -100,15 +234,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
234
  requirements:
101
235
  - - ">="
102
236
  - !ruby/object:Gem::Version
103
- version: 3.1.0
237
+ version: 3.3.0
104
238
  required_rubygems_version: !ruby/object:Gem::Requirement
105
239
  requirements:
106
240
  - - ">="
107
241
  - !ruby/object:Gem::Version
108
242
  version: '0'
109
243
  requirements: []
110
- rubygems_version: 3.4.10
111
- signing_key:
244
+ rubygems_version: 3.6.2
112
245
  specification_version: 4
113
246
  summary: Generate Diagrams and Flowcharts with Mermaid
114
247
  test_files: []
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mermaid
4
- class BaseDiagram < Dry::Struct
5
- module Types
6
- include Dry.Types()
7
- end
8
-
9
- def to_s
10
- generate
11
- end
12
- end
13
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mermaid
4
- class C4Diagram < BaseDiagram
5
- def initialize(*)
6
- raise NotImplementedError, "C4Diagram is not implemented yet"
7
- end
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mermaid
4
- class ClassDiagram < BaseDiagram
5
- def initialize(*)
6
- raise NotImplementedError, "ClassDiagram is not implemented yet"
7
- end
8
-
9
- end
10
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mermaid
4
- class ERDiagram < BaseDiagram
5
- def initialize(*)
6
- raise NotImplementedError, "ERDiagram is not implemented yet"
7
- end
8
- end
9
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mermaid
4
- class FlowchartDiagram::Link < Dry::Struct
5
- attribute :from, FlowchartDiagram::Types::String
6
- attribute :to, FlowchartDiagram::Types::String
7
- attribute :label, FlowchartDiagram::Types::String.optional.default(nil)
8
- attribute :type, FlowchartDiagram::Types::String.default('arrow_head')
9
- .enum('arrow_head',
10
- 'open_link',
11
- 'text_link',
12
- 'dotted',
13
- 'thick',
14
- 'invisible'
15
- )
16
-
17
- def representation
18
- case type
19
- when 'arrow_head'
20
- if label.nil?
21
- '-->'
22
- else
23
- "-->|#{label_representation}|"
24
- end
25
- end
26
- end
27
-
28
- def label_representation
29
- ## if label is unicode return it with quotes
30
- ## else return it without quotes
31
- if label.nil?
32
- ''
33
- else
34
- if label.ascii_only?
35
- label
36
- else
37
- "\"#{label}\""
38
- end
39
- end
40
- end
41
-
42
- def to_s
43
- [from, representation, to].join
44
- end
45
- end
46
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mermaid
4
- class FlowchartDiagram::Node < Dry::Struct
5
- SHAPES = %w(default round stadium subroutine database circle double_circle asymmetric rhombus hexagon parallelogram parallelogram_alt trapezoid trapezoid_alt).freeze
6
-
7
- SHAPE_FORMATS = {
8
- 'default' => "%s[%s]", # A[Hard
9
- 'round' => "%s(%s)", # A(Hard)
10
- 'stadium' => "%s([%s])", # A([Hard])
11
- 'subroutine' => "%s[[%s]]", # A([[Hard]])
12
- 'database' => "%s[(%s)]", # A[(Hard)]
13
- 'circle' => "%s((%s))", # A((Hard))
14
- 'double_circle' => "%s(((%s)))", # A(((Hard)))
15
- 'asymmetric' => "%s>%s]", # A>Hard]
16
- 'rhombus' => "%s{%s}", # A{Hard}
17
- 'hexagon' => "%s{{%s}}", # A{{Hard}}
18
- 'parallelogram' => "%s[/%s/]", # A[/Hard/]
19
- 'parallelogram_alt' => "%s[\\%s\\]", # A[\Hard\]
20
- 'trapezoid' => "%s[/%s\\]", # A[/Hard\]
21
- 'trapezoid_alt' => "%s[\\%s/]" # A[\Hard/]
22
- }.freeze
23
-
24
- attribute :id, FlowchartDiagram::Types::String
25
- attribute :label, FlowchartDiagram::Types::String
26
- attribute :shape, FlowchartDiagram::Types::String.default('default').enum(*SHAPES)
27
-
28
- def to_s(show_label = true)
29
- if show_label
30
- format(SHAPE_FORMATS[shape], id, label)
31
- else
32
- id
33
- end
34
- end
35
- end
36
- end