Module: Gamefic::Scriptable::Queries
- Includes:
- Proxy
- Included in:
- Narrative, Gamefic::Scriptable, Actions
- Defined in:
- lib/gamefic/scriptable/queries.rb
Overview
Scriptable methods related to creating action queries.
Instance Method Summary collapse
-
#anywhere(*args, ambiguous: false) ⇒ Query::General
Define a query that searches the entire plot’s entities.
-
#available(*args, ambiguous: false) ⇒ Query::Scoped
(also: #family)
Define a query that searches an actor’s family of entities.
-
#children(*args, ambiguous: false) ⇒ Query::Scoped
Define a query that searches an actor’s children.
-
#myself(*args, ambiguous: false) ⇒ Query::Scoped
Define a query that returns the actor itself.
-
#parent(*args, ambiguous: false) ⇒ Query::Scoped
Define a query that returns the actor’s parent.
-
#plaintext(arg = nil) ⇒ Query::Text
Define a query that performs a plaintext search.
-
#siblings(*args, ambiguous: false) ⇒ Query::Scoped
Define a query that searches an actor’s siblings.
Methods included from Proxy
Instance Method Details
#anywhere(*args, ambiguous: false) ⇒ Query::General
Define a query that searches the entire plot’s entities.
14 15 16 |
# File 'lib/gamefic/scriptable/queries.rb', line 14 def anywhere *args, ambiguous: false Query::General.new -> { entities }, *unproxy(args), ambiguous: ambiguous end |
#available(*args, ambiguous: false) ⇒ Query::Scoped Also known as: family
Define a query that searches an actor’s family of entities. The results include the parent, siblings, children, and accessible descendants of siblings and children.
24 25 26 |
# File 'lib/gamefic/scriptable/queries.rb', line 24 def available *args, ambiguous: false Query::Scoped.new Scope::Family, *unproxy(args), ambiguous: ambiguous end |
#children(*args, ambiguous: false) ⇒ Query::Scoped
Define a query that searches an actor’s children.
41 42 43 |
# File 'lib/gamefic/scriptable/queries.rb', line 41 def children *args, ambiguous: false Query::Scoped.new Scope::Children, *unproxy(args), ambiguous: ambiguous end |
#myself(*args, ambiguous: false) ⇒ Query::Scoped
Define a query that returns the actor itself.
57 58 59 |
# File 'lib/gamefic/scriptable/queries.rb', line 57 def myself *args, ambiguous: false Query::Scoped.new Scope::Myself, *unproxy(args), ambiguous: ambiguous end |
#parent(*args, ambiguous: false) ⇒ Query::Scoped
Define a query that returns the actor’s parent.
33 34 35 |
# File 'lib/gamefic/scriptable/queries.rb', line 33 def parent *args, ambiguous: false Query::Scoped.new Scope::Parent, *unproxy(args), ambiguous: ambiguous end |
#plaintext(arg = nil) ⇒ Query::Text
Define a query that performs a plaintext search. It can take a String or a RegExp as an argument. If no argument is provided, it will match any text it finds in the command. A successful query returns the corresponding text instead of an entity.
68 69 70 |
# File 'lib/gamefic/scriptable/queries.rb', line 68 def plaintext arg = nil Query::Text.new arg end |