Class: RD::ElementRelationship

Inherits:
Object
  • Object
show all
Defined in:
lib/rd/document-struct.rb

Overview

ElementRelationship is knowledge about parent-children relationship between Elements.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, child) ⇒ ElementRelationship

Returns a new instance of ElementRelationship.



37
38
39
40
# File 'lib/rd/document-struct.rb', line 37

def initialize(parent, child)
  @parent = parent
  @child = child
end

Instance Attribute Details

#childObject (readonly)

Returns the value of attribute child.



35
36
37
# File 'lib/rd/document-struct.rb', line 35

def child
  @child
end

#parentObject (readonly)

Returns the value of attribute parent.



35
36
37
# File 'lib/rd/document-struct.rb', line 35

def parent
  @parent
end

Instance Method Details

#match?(parent, child) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/rd/document-struct.rb', line 42

def match?(parent, child)
  parent.is_a? @parent and child.is_a? @child
end