class Gamefic::Query::Scoped
A Scoped
query uses a Scope
to select entities to filter based on their relationship to the entity performing the query. For example, Scope::Children
would filter from an array of the entity’s descendants.
Attributes
scope[R]
Public Class Methods
new(scope, *arguments, ambiguous: false, name: nil)
click to toggle source
@param scope [Class<Gamefic::Scope::Base>]
Calls superclass method
Gamefic::Query::Base::new
# File lib/gamefic/query/scoped.rb, line 13 def initialize scope, *arguments, ambiguous: false, name: nil super(*arguments, ambiguous: ambiguous, name: name) @scope = scope end
Public Instance Methods
precision()
click to toggle source
# File lib/gamefic/query/scoped.rb, line 22 def precision @precision ||= @scope.precision + calculate_precision end
span(subject)
click to toggle source
# File lib/gamefic/query/scoped.rb, line 18 def span(subject) @scope.matches(subject) end