Class: Wads::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/wads/data_structures.rb

Overview

An Edge is a connection between nodes that stores additional information as arbitrary tags, or name/value pairs.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(destination, tags = {}) ⇒ Edge

Returns a new instance of Edge.



458
459
460
461
# File 'lib/wads/data_structures.rb', line 458

def initialize(destination, tags = {})
    @destination = destination
    @tags = tags
end

Instance Attribute Details

#destinationObject

Returns the value of attribute destination.



455
456
457
# File 'lib/wads/data_structures.rb', line 455

def destination
  @destination
end

#tagsObject

Returns the value of attribute tags.



456
457
458
# File 'lib/wads/data_structures.rb', line 456

def tags
  @tags
end

Instance Method Details

#add_tag(key, value) ⇒ Object



463
464
465
# File 'lib/wads/data_structures.rb', line 463

def add_tag(key, value)
    @tags[key] = value 
end

#get_tag(key) ⇒ Object



467
468
469
# File 'lib/wads/data_structures.rb', line 467

def get_tag(key) 
    @tags[key] 
end