Class: Gamefic::Query::Family

Inherits:
Base show all
Defined in:
lib/gamefic/query/family.rb

Overview

Query to retrieve the subject’s siblings and all accessible descendants.

Direct Known Subclasses

Tree

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
15
# File 'lib/gamefic/query/family.rb', line 6

def context_from(subject)
  result = []
  result.concat subquery_accessible(subject.parent)
  result.delete subject
  subject.children.each { |c|
    result.push c
    result.concat subquery_accessible(c)
  }
  result
end