Module: Holistic::Ruby::Scope::Lexical

Extended by:
Lexical
Included in:
Lexical
Defined in:
lib/holistic/ruby/scope/lexical.rb

Instance Method Summary collapse

Instance Method Details

#descendant?(child:, parent:) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/holistic/ruby/scope/lexical.rb', line 6

def descendant?(child:, parent:)
  child_parent = child.lexical_parent

  child_parent.present? && (child_parent == parent || descendant?(child: child_parent, parent:))
end