Class: ERDEntity
- Inherits:
-
Object
- Object
- ERDEntity
- Defined in:
- lib/ruby-erd/erd_entity.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/ruby-erd/erd_entity.rb', line 3 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
3 4 5 |
# File 'lib/ruby-erd/erd_entity.rb', line 3 def node @node end |
Instance Method Details
#attributes=(attributes) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/ruby-erd/erd_entity.rb', line 5 def attributes=(attributes) attributes_as_string = attributes.collect do |key, value| "#{key} :#{value}" end.join('\l') @node.label = "{#{name}| #{attributes_as_string}}" end |
#background_color=(color) ⇒ Object
13 14 15 16 |
# File 'lib/ruby-erd/erd_entity.rb', line 13 def background_color=(color) @node.color = color @node.style = :filled end |
#build(attributes) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ruby-erd/erd_entity.rb', line 18 def build(attributes) @graph = attributes[:graph] @name = attributes[:name] # Returns a GraphViz::Node @node = @graph.add_nodes(name, shape: 'record') end |