yml2erd 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30861d60e3b7ec898d77d7651b115801e4a2411e
4
- data.tar.gz: c89d8ff74ca28c0ffd9b8289e5c403acf90867f9
3
+ metadata.gz: f2559f6e066eeec7dec8fa5b69954f31ac61e6fb
4
+ data.tar.gz: ea165d8d635601f4b932f6b44c93a6aa58f12263
5
5
  SHA512:
6
- metadata.gz: 0d63ce75a0dc3b53a456ef574c238ac2da6f9369931783e6f9fbaea0126425994f8f92e3212298d486429bf7df100e32316eca3d1310c3336aea5ca03a749493
7
- data.tar.gz: 0629c73061313f60e203098664648d8f7117bd5f07c59dba1894d4f5fe978352397a2f2ab2beb0b8203eea7edbe6b34ee9c3e0458d0f5ec5cb6b09d21b543c2b
6
+ metadata.gz: b42de50a6a3e97539534a550963fae46fdc8278ce2199fc807269b6c94ba9e8aa3933b0bb1b545f5f722c7f561058315b23f42eb23c7c5393d9f11ecad6c3487
7
+ data.tar.gz: cb1a0a5595feaaae8b6edbb2e19bea23972f4b4729cc4d56fcd82e5d3ef5ff0eef04585adf18b52633bb46c630d5c78b1ce9122f3a8b7d097ad55c3151344bef
@@ -20,7 +20,8 @@ module Yml2erd
20
20
  end
21
21
 
22
22
  index = schema_structure.index(table_name)
23
- label = build_label(table_name, columns, index)
23
+ comment = schema_structure.comment(table_name)
24
+ label = build_label(table_name, columns, index, comment)
24
25
  g.add_nodes(table_name, shape: "record", label: label, style: "rounded")
25
26
  end
26
27
 
@@ -40,12 +41,15 @@ module Yml2erd
40
41
  end
41
42
  end
42
43
 
43
- def build_label(table_name, columns, index)
44
- if index
45
- "<{<FONT POINT-SIZE='15'>#{table_name}</FONT> | #{columns} | indexed: #{index.to_s}}>"
46
- else
47
- "<{<FONT POINT-SIZE='15'>#{table_name}</FONT> | #{columns}}>"
48
- end
44
+ def build_label(table_name, columns, index, comment)
45
+ partial ||= "| indexed: #{index.to_s}" if index
46
+ partial += "| #{comment}" if comment
47
+ base_label(table_name, columns, partial)
48
+ end
49
+
50
+ # TODO: Contemplates method name
51
+ def base_label(table_name, columns, partial = nil)
52
+ base = "<{<FONT POINT-SIZE='15'>#{table_name}</FONT> | #{columns}#{partial}}>"
49
53
  end
50
54
 
51
55
  def build_column(name, type)
@@ -53,5 +53,11 @@ module Yml2erd
53
53
  def shared_columns
54
54
  structure_yml['shared_columns']
55
55
  end
56
+
57
+ # returns a string like below
58
+ # => "This is users table"
59
+ def comment(table_name)
60
+ structure_yml[table_name]['comment']
61
+ end
56
62
  end
57
63
  end
@@ -1,3 +1,3 @@
1
1
  module Yml2erd
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.8"
3
3
  end
data/sample.yml CHANGED
@@ -10,6 +10,7 @@ companies:
10
10
  has_many:
11
11
  - users
12
12
  users:
13
+ comment: This is users table.
13
14
  columns:
14
15
  - crypted_password: string
15
16
  - email: string
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yml2erd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - asmsuechan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-28 00:00:00.000000000 Z
11
+ date: 2017-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-graphviz