Class: RailsFlowMap::FlowNode

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_flow_map/models/flow_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, type:, attributes: {}, file_path: nil, line_number: nil) ⇒ FlowNode



5
6
7
8
9
10
11
12
# File 'lib/rails_flow_map/models/flow_node.rb', line 5

def initialize(id:, name:, type:, attributes: {}, file_path: nil, line_number: nil)
  @id = id
  @name = name
  @type = type
  @attributes = attributes
  @file_path = file_path
  @line_number = line_number
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/rails_flow_map/models/flow_node.rb', line 3

def attributes
  @attributes
end

#file_pathObject

Returns the value of attribute file_path.



3
4
5
# File 'lib/rails_flow_map/models/flow_node.rb', line 3

def file_path
  @file_path
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/rails_flow_map/models/flow_node.rb', line 3

def id
  @id
end

#line_numberObject

Returns the value of attribute line_number.



3
4
5
# File 'lib/rails_flow_map/models/flow_node.rb', line 3

def line_number
  @line_number
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/rails_flow_map/models/flow_node.rb', line 3

def name
  @name
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/rails_flow_map/models/flow_node.rb', line 3

def type
  @type
end

Instance Method Details

#action?Boolean



22
23
24
# File 'lib/rails_flow_map/models/flow_node.rb', line 22

def action?
  type == :action
end

#controller?Boolean



18
19
20
# File 'lib/rails_flow_map/models/flow_node.rb', line 18

def controller?
  type == :controller
end

#model?Boolean



14
15
16
# File 'lib/rails_flow_map/models/flow_node.rb', line 14

def model?
  type == :model
end

#to_hObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/rails_flow_map/models/flow_node.rb', line 26

def to_h
  {
    id: id,
    name: name,
    type: type,
    attributes: attributes,
    file_path: file_path,
    line_number: line_number
  }
end