Class: AsciiTree::Relationship

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent_word:, edge:, child_word:) ⇒ Relationship

Returns a new instance of Relationship.



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

def initialize(parent_word:, edge:, child_word:)
  @parent_word = parent_word
  @edge        = edge
  @child_word  = child_word
end

Instance Attribute Details

#child_wordObject (readonly)

Returns the value of attribute child_word.



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

def child_word
  @child_word
end

#edgeObject (readonly)

Returns the value of attribute edge.



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

def edge
  @edge
end

#parent_wordObject (readonly)

Returns the value of attribute parent_word.



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

def parent_word
  @parent_word
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
15
# File 'lib/ascii_tree/relationship.rb', line 11

def ==(other)
  parent_word == other.parent_word &&
    edge == other.edge &&
    child_word == other.child_word
end