Class: Gamefic::Query::Tree

Inherits:
Family show all
Defined in:
lib/gamefic/query/tree.rb

Overview

Query to retrieve all of the subject’s ancestors, siblings, and descendants.

Constant Summary

Constants inherited from Base

Base::NEST_REGEXP

Instance Attribute Summary

Attributes inherited from Base

#arguments

Instance Method Summary collapse

Methods inherited from Base

#accept?, #ambiguous?, #include?, #initialize, #precision, #resolve, #signature

Constructor Details

This class inherits a constructor from Gamefic::Query::Base

Instance Method Details

#context_from(subject) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/gamefic/query/tree.rb', line 6

def context_from(subject)
  result = super
  parent = subject.parent
  until parent.nil?
    result.unshift parent
    parent = parent.parent
  end
  result
end