Skip to content

Commit fe7d01e

Browse files
committed
Ruby: Update docs to reflect that import ruby is no longer used
1 parent b477a4c commit fe7d01e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

docs/codeql/codeql-language-guides/basic-query-for-ruby-code.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Running the query
3636

3737
.. code-block:: ql
3838
39-
import ruby
39+
import codeql.ruby.AST
4040
4141
from IfExpr ifexpr
4242
where
@@ -80,7 +80,7 @@ After the initial ``import`` statement, this simple query comprises three parts
8080
+---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
8181
| Query part | Purpose | Details |
8282
+===============================================================+===================================================================================================================+========================================================================================================================+
83-
| ``import ruby`` | Imports the standard CodeQL libraries for Ruby. | Every query begins with one or more ``import`` statements. |
83+
| ``import codeql.ruby.AST`` | Imports the standard CodeQL AST libraries for Ruby. | Every query begins with one or more ``import`` statements. |
8484
+---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
8585
| ``from IfExpr ifexpr`` | Defines the variables for the query. | We use: an ``IfExpr`` variable for ``if`` expressions. |
8686
| | Declarations are of the form: | |

docs/codeql/codeql-language-guides/codeql-library-for-ruby.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ library by beginning your query with:
1818

1919
.. code-block:: ql
2020
21-
import ruby
21+
import codeql.ruby.AST
2222
2323
The CodeQL libraries model various aspects of Ruby code, depending on the type of query you want to write.
2424
For example the abstract syntax tree (AST) library is used for locating program elements, to match syntactic
@@ -138,7 +138,7 @@ The following example lists all methods in the class `ApiController`:
138138

139139
.. code-block:: ql
140140
141-
import ruby
141+
import codeql.ruby.AST
142142
143143
from ClassDeclaration m
144144
where m.getName() = "ApiController"
@@ -223,7 +223,7 @@ Example
223223

224224
.. code-block:: ql
225225
226-
import ruby
226+
import codeql.ruby.AST
227227
228228
from Method m
229229
where m.getName() = "show"
@@ -274,7 +274,7 @@ The following example finds all literals that are returned by a `return` stateme
274274

275275
.. code-block:: ql
276276
277-
import ruby
277+
import codeql.ruby.AST
278278
279279
from ReturnStmt return, Literal lit
280280
where lit.getParent() = return
@@ -421,7 +421,7 @@ The following example finds "chained assignments" (of the form ``A=B=C``):
421421

422422
.. code-block:: ql
423423
424-
import ruby
424+
import codeql.ruby.AST
425425
426426
from Assignment op
427427
where op.getRightOperand() instanceof Assignment
@@ -460,7 +460,7 @@ The following example finds all method calls to a method called `delete`.
460460

461461
.. code-block:: ql
462462
463-
import ruby
463+
import codeql.ruby.AST
464464
465465
from MethodCall call
466466
where call.getMethodName() = "delete"
@@ -517,7 +517,7 @@ The following example finds `if`-expressions that are missing a `then` branch.
517517

518518
.. code-block:: ql
519519
520-
import ruby
520+
import codeql.ruby.AST
521521
522522
from IfExpr expr
523523
where not exists(expr.getThen())
@@ -559,7 +559,7 @@ The following example finds all class variables in the class `StaticController`:
559559

560560
.. code-block:: ql
561561
562-
import ruby
562+
import codeql.ruby.AST
563563
564564
from ClassDeclaration cd, ClassVariable v
565565
where
@@ -612,7 +612,7 @@ The following example finds writes to class variables in the class `StaticContro
612612

613613
.. code-block:: ql
614614
615-
import ruby
615+
import codeql.ruby.AST
616616
617617
from ClassVariableWriteAccess write, ClassDeclaration cd, ClassVariable v
618618
where

0 commit comments

Comments
 (0)