Class: AsciiTree::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/ascii_tree/edge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(character:, coordinate:, parent_coordinate:, child_coordinate:) ⇒ Edge

Returns a new instance of Edge.



5
6
7
8
9
10
# File 'lib/ascii_tree/edge.rb', line 5

def initialize(character:, coordinate:, parent_coordinate:, child_coordinate:)
  @character         = character
  @coordinate        = coordinate
  @parent_coordinate = parent_coordinate
  @child_coordinate  = child_coordinate
end

Instance Attribute Details

#characterObject (readonly)

Returns the value of attribute character.



3
4
5
# File 'lib/ascii_tree/edge.rb', line 3

def character
  @character
end

#child_coordinateObject (readonly)

Returns the value of attribute child_coordinate.



3
4
5
# File 'lib/ascii_tree/edge.rb', line 3

def child_coordinate
  @child_coordinate
end

#coordinateObject (readonly)

Returns the value of attribute coordinate.



3
4
5
# File 'lib/ascii_tree/edge.rb', line 3

def coordinate
  @coordinate
end

#parent_coordinateObject (readonly)

Returns the value of attribute parent_coordinate.



3
4
5
# File 'lib/ascii_tree/edge.rb', line 3

def parent_coordinate
  @parent_coordinate
end

Instance Method Details

#==(other) ⇒ Object



12
13
14
15
16
17
# File 'lib/ascii_tree/edge.rb', line 12

def ==(other)
  character == other.character &&
    coordinate == other.coordinate &&
    parent_coordinate == other.parent_coordinate &&
    child_coordinate == other.child_coordinate
end