Class: NoSE::Random::Network
Overview
A simple representation of a random ER diagram
Direct Known Subclasses
Instance Attribute Summary collapse
-
#entities ⇒ Object
readonly
Returns the value of attribute entities.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Network
constructor
A new instance of Network.
-
#inspect ⇒ Object
:nocov:.
Constructor Details
#initialize(params = {}) ⇒ Network
Returns a new instance of Network.
11 12 13 14 15 |
# File 'lib/nose/random.rb', line 11 def initialize(params = {}) @nodes_nb = params.fetch :nodes_nb, 10 @field_count = RandomGaussian.new params.fetch(:num_fields, 3), 1 @neighbours = Array.new(@nodes_nb) { Set.new } end |
Instance Attribute Details
#entities ⇒ Object (readonly)
Returns the value of attribute entities.
9 10 11 |
# File 'lib/nose/random.rb', line 9 def entities @entities end |
Instance Method Details
#inspect ⇒ Object
:nocov:
18 19 20 21 22 |
# File 'lib/nose/random.rb', line 18 def inspect @nodes.map do |node| @entities[node].inspect end.join "\n" end |