Class: RailsGraph::Graph::Nodes::AbstractModel

Inherits:
RailsGraph::Graph::Node show all
Defined in:
lib/rails_graph/graph/nodes/abstract_model.rb

Instance Attribute Summary collapse

Attributes inherited from RailsGraph::Graph::Node

#labels

Attributes inherited from Entity

#id, #name, #properties

Instance Method Summary collapse

Methods inherited from RailsGraph::Graph::Node

#as_json

Constructor Details

#initialize(model) ⇒ AbstractModel

Returns a new instance of AbstractModel.



11
12
13
14
15
16
17
18
19
# File 'lib/rails_graph/graph/nodes/abstract_model.rb', line 11

def initialize(model)
  @model = model

  super(
    labels: "AbstractModel",
    name: model.name,
    properties: {}
  )
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



9
10
11
# File 'lib/rails_graph/graph/nodes/abstract_model.rb', line 9

def model
  @model
end

Instance Method Details

#identifierObject



21
22
23
# File 'lib/rails_graph/graph/nodes/abstract_model.rb', line 21

def identifier
  RailsGraph::Helpers::Models.identifier(model)
end