Class: Gamefic::Query::Ascendants
- Includes:
- Subqueries
- Defined in:
- lib/gamefic/query/ascendants.rb
Overview
Query the subject’s parent and accessible grandparents.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Subqueries
Methods inherited from Base
#accept?, #bind, #filter, #initialize, #inspect, #name, plain, #precision, #select, span
Constructor Details
This class inherits a constructor from Gamefic::Query::Base
Instance Method Details
#span(subject) ⇒ Object
10 11 12 13 |
# File 'lib/gamefic/query/ascendants.rb', line 10 def span(subject) [subject.parent].tap { |result| result.push result.last.parent while result.last&.parent&.accessible&.include?(result.last) } .compact end |