Class: Flowckerc::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/flowckerc/tokens.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_atom, from_port, to_atom, to_port) ⇒ Link

Returns a new instance of Link.



23
24
25
26
27
28
29
# File 'lib/flowckerc/tokens.rb', line 23

def initialize from_atom, from_port, to_atom, to_port
  @id = UniqueID.next
  @from_atom = from_atom
  @from_port = from_port
  @to_atom = to_atom
  @to_port = to_port
end

Instance Attribute Details

#from_atomObject

Returns the value of attribute from_atom.



18
19
20
# File 'lib/flowckerc/tokens.rb', line 18

def from_atom
  @from_atom
end

#from_portObject

Returns the value of attribute from_port.



19
20
21
# File 'lib/flowckerc/tokens.rb', line 19

def from_port
  @from_port
end

#idObject (readonly)

Returns the value of attribute id.



17
18
19
# File 'lib/flowckerc/tokens.rb', line 17

def id
  @id
end

#to_atomObject

Returns the value of attribute to_atom.



20
21
22
# File 'lib/flowckerc/tokens.rb', line 20

def to_atom
  @to_atom
end

#to_portObject

Returns the value of attribute to_port.



21
22
23
# File 'lib/flowckerc/tokens.rb', line 21

def to_port
  @to_port
end

Instance Method Details

#toHashObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/flowckerc/tokens.rb', line 31

def toHash
  {
      id: @id,
      from: {
        atomID: @from_atom,
        port: {
          name: @from_port
        }
      },
      to: {
        atomID: @to_atom,
        port: {
          name: @to_port
        }
      }
  }
end