Class: Gamefic::Query::Descendants

Inherits:
Base
  • Object
show all
Includes:
Subqueries
Defined in:
lib/gamefic/query/descendants.rb

Overview

Query the subject’s children and accessible grandchildren.

Instance Attribute Summary

Attributes inherited from Base

#arguments

Instance Method Summary collapse

Methods included from Subqueries

subquery_accessible

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
14
# File 'lib/gamefic/query/descendants.rb', line 10

def span(subject)
  subject.children.flat_map do |child|
    [child] + subquery_accessible(child)
  end
end