Class: NetworkDrawer::Element::Connection
- Defined in:
- lib/network_drawer/element/connection.rb
Overview
Replesent of connection
Constant Summary collapse
- DEFAULT_STYLE =
{}
Instance Method Summary collapse
-
#initialize(initial_values = {}, style = {}) ⇒ Connection
constructor
A new instance of Connection.
- #to_code ⇒ Object
Methods inherited from Element
Constructor Details
#initialize(initial_values = {}, style = {}) ⇒ Connection
Returns a new instance of Connection.
9 10 11 12 |
# File 'lib/network_drawer/element/connection.rb', line 9 def initialize(initial_values = {}, style = {}) super @default_style = DEFAULT_STYLE end |
Instance Method Details
#to_code ⇒ Object
14 15 16 17 18 19 |
# File 'lib/network_drawer/element/connection.rb', line 14 def to_code style = style(self.type).dup style.merge!(self.to_hash) cid = "#{self.from}_#{self.to}_#{self.id}".gsub('/', '').to_sym "edge(:\"#{cid}\", #{style})\n" end |