Class: Gamefic::Query::Family

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

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, #rank, #resolve, #signature

Constructor Details

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

Instance Method Details

#context_from(subject) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gamefic/query/family.rb', line 4

def context_from(subject)
  result = []
  top = subject.parent
  unless top.nil?
    #until top.parent.nil?
    #  top = top.parent
    #end
    result.concat subquery_accessible(top)
  end
  result.delete subject
  subject.children.each { |c|
    result.push c
    result.concat subquery_accessible(c)
  }
  result
end