Module: Gamefic::Scriptable::Queries
- Included in:
- Action, Response, Gamefic::Scriptable, Responses, Gamefic::Scripting
- Defined in:
- lib/gamefic/scriptable/queries.rb
Overview
Scriptable methods related to creating action queries.
Instance Method Summary collapse
-
#available(*args) ⇒ Query::Family
(also: #family, #avail)
Define a query that searches an actor’s family of entities.
-
#children(*args) ⇒ Query::Children
Define a query that searches an actor’s children.
-
#descendants(*args) ⇒ Query::Descendants
Define a query that searches an actor’s descendants.
-
#extended(*args) ⇒ Query::Extended
Define a query that searches an actor’s siblings and their descendants.
-
#global(*args) ⇒ Query::Global
(also: #anywhere)
Define a query that searches all entities in the subject’s epic.
-
#integer ⇒ Query::Integer
Define a query that matches integers.
-
#myself(*args) ⇒ Query::Myself
Define a query that returns the actor itself.
-
#parent(*args) ⇒ Query::Parent
Define a query that returns the actor’s parent.
-
#plaintext(arg = /.*/) ⇒ Query::Text
Define a query that performs a plaintext search.
-
#siblings(*args) ⇒ Query::Siblings
Define a query that searches an actor’s siblings.
Instance Method Details
#available(*args) ⇒ Query::Family Also known as: family, avail
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.
25 26 27 |
# File 'lib/gamefic/scriptable/queries.rb', line 25 def available *args Query::Family.new(*args, name: 'available') end |
#children(*args) ⇒ Query::Children
Define a query that searches an actor’s children.
43 44 45 |
# File 'lib/gamefic/scriptable/queries.rb', line 43 def children *args Query::Children.new(*args, name: 'children') end |
#descendants(*args) ⇒ Query::Descendants
Define a query that searches an actor’s descendants.
51 52 53 |
# File 'lib/gamefic/scriptable/queries.rb', line 51 def descendants *args Query::Descendants.new(*args) end |
#extended(*args) ⇒ Query::Extended
Define a query that searches an actor’s siblings and their descendants.
67 68 69 |
# File 'lib/gamefic/scriptable/queries.rb', line 67 def extended *args Query::Extended.new(*args, name: 'extended') end |
#global(*args) ⇒ Query::Global Also known as: anywhere
Define a query that searches all entities in the subject’s epic.
If the subject is not an actor, the result will always be empty.
14 15 16 |
# File 'lib/gamefic/scriptable/queries.rb', line 14 def global *args Query::Global.new(*args, name: 'global') end |
#integer ⇒ Query::Integer
Define a query that matches integers. Unlike other queries, #integer does not take arguments. It will match and return an integer if the corresponding command token is an integer or the corresponding input is a string representation of an integer. A successful query returns the integer instead of an entity.
97 98 99 |
# File 'lib/gamefic/scriptable/queries.rb', line 97 def integer Query::Integer.new name: 'integer' end |
#myself(*args) ⇒ Query::Myself
Define a query that returns the actor itself.
75 76 77 |
# File 'lib/gamefic/scriptable/queries.rb', line 75 def myself *args Query::Myself.new(*args, name: 'myself') end |
#parent(*args) ⇒ Query::Parent
Define a query that returns the actor’s parent.
35 36 37 |
# File 'lib/gamefic/scriptable/queries.rb', line 35 def parent *args Query::Parent.new(*args, name: 'parent') end |
#plaintext(arg = /.*/) ⇒ 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.
86 87 88 |
# File 'lib/gamefic/scriptable/queries.rb', line 86 def plaintext(arg = /.*/) Query::Text.new arg, name: 'plaintext' end |
#siblings(*args) ⇒ Query::Siblings
Define a query that searches an actor’s siblings.
59 60 61 |
# File 'lib/gamefic/scriptable/queries.rb', line 59 def siblings *args Query::Siblings.new(*args, name: 'siblings') end |