mongoid-erd 0.0.3 → 0.0.5

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.
@@ -3,6 +3,7 @@
3
3
  class Hello # erd{color: red} Hello Class
4
4
  field :name, type:String # erd Name Field
5
5
  field :link, type:String # -> World
6
+ as_enum :gender, :male => 1, :female => 2 # erd: 性别
6
7
 
7
8
  def say # erd say hello world
8
9
 
@@ -134,9 +134,9 @@ class MongoidErd
134
134
  field_.name = "#{rel_} (as #{as_})" if as_
135
135
  self.parse_erd field_, line # parse erd attr and label
136
136
  crt_model.fields << field_
137
- unless %w[belongs_to embedded_in].include? rel_
138
- field_.edge = [name_, '', {label: rel_}]
139
- end
137
+ #if %w[belongs_to embedded_in embeds_one has_one].include? rel_
138
+ field_.edge = [name_, '', {label: rel_, arrowhead: 'onormal'}]
139
+ #end
140
140
  end
141
141
 
142
142
  # common extension field
@@ -154,6 +154,15 @@ class MongoidErd
154
154
  self.parse_erd field_, line # parse erd attr and label
155
155
  crt_model.fields << field_
156
156
  end
157
+
158
+ if /\s*as_enum\s+\:(?<name_>\w+)\s*\,\s*(?<enum_>[^#]+)/ =~ line
159
+ field_ = Fields.new
160
+ field_.name = name_
161
+ field_.type = "[ENUM] " + enum_
162
+ self.parse_erd field_, line # parse erd attr and label
163
+ crt_model.fields << field_
164
+ end
165
+
157
166
  end # open and parse one file
158
167
 
159
168
  # assign attributes at the last moment
@@ -1,6 +1,6 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
2
 
3
- Gem::Specification.new 'mongoid-erd', '0.0.3' do |s|
3
+ Gem::Specification.new 'mongoid-erd', '0.0.5' do |s|
4
4
  s.executables << "merd"
5
5
  s.description = "Create model diagram graph (ERD graph) in graphviz's dot language"
6
6
  s.summary = "Mongoid ERD diagram creator"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-erd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: