Skip to content

Commit bde2aa8

Browse files
Fix file oop methods
1 parent ed45754 commit bde2aa8

File tree

7 files changed

+22
-26
lines changed

7 files changed

+22
-26
lines changed

functions/File/fileCopy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ shared: &shared
66
If you do not want to share the content of the created file with other servers, prepend the file path with @ (See [[filepath]] for more information).
77
oop:
88
entity: file
9+
static: true
910
method: copy
1011
description: This function copies a file.
1112
parameters:

functions/File/fileCreate.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ shared: &shared
1212
It is important to remember to close a file after you've finished all your operations on it, especially if you've been writing to the file. If you don't close a file and your resource crashes, all changes to the file may be lost.
1313
oop:
1414
entity: file
15+
static: true
1516
method: new
1617
description: Creates a new file in a directory of a resource. If there already exists a file with the specified name, it is overwritten with an empty file.
1718
parameters:

functions/File/fileDelete.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ shared: &shared
22
name: fileDelete
33
oop:
44
entity: file
5+
static: true
56
method: delete
67
description: Deletes the specified file.
78
parameters:

functions/File/fileExists.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ shared: &shared
22
name: fileExists
33
oop:
44
entity: file
5+
static: true
56
method: exists
67
description: This functions checks whether a specified file exists inside a resource.
78
parameters:

functions/File/fileOpen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ shared: &shared
55
content: To prevent memory leaks, ensure each successful call to [[fileOpen]] has a matching call to [[fileClose]].
66
oop:
77
entity: file
8-
method: open
8+
constructorclass: File
99
description: Opens an existing file for reading and writing.
1010
parameters:
1111
- name: 'filePath'

web/src/components/ElementOOPInfo.astro

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let oop_constructor = oop_compatible_functions.find(func => func.oop.constructor
1515
<section class="oop-constructor-section">
1616
<h4><a href="/OOP_Introduction">OOP</a> Constructor</h4>
1717
<p>
18-
<code>{oop_constructor.oop.constructorclass}(...)</code> is the constructor method for the <code>{element_name}</code> class (<a href={oop_constructor.link}>{oop_constructor.name}</a>).
18+
{oop_constructor.oop.constructorclass}(...) is the constructor method for the <code>{element_name}</code> class (<a href={oop_constructor.link}>{oop_constructor.name}</a>).
1919
</p>
2020
</section>
2121
)}
@@ -25,30 +25,22 @@ let oop_constructor = oop_compatible_functions.find(func => func.oop.constructor
2525
<h4><a href="/OOP_Introduction">OOP</a> Methods and Variables</h4>
2626
<ul>
2727
{oop_compatible_functions.map((funcInfo: any) => (
28-
<li>
29-
{funcInfo.oop.constructorclass ? (
30-
<span>
31-
<strong>Constructor</strong>:
32-
{funcInfo.oop.constructorclass}(...)
33-
</span>
34-
) : (
35-
<>
36-
{funcInfo.oop.method && (
37-
<span style="margin-right: 10px;">
38-
<strong>Method</strong>:
39-
{funcInfo.oop.static ? funcInfo.oop.entity.charAt(0).toUpperCase() + funcInfo.oop.entity.slice(1) : funcInfo.oop.entity}{funcInfo.oop.static ? '.' : ':'}<a href={funcInfo.link} title={funcInfo.name}>{funcInfo.oop.method}</a>(...)
40-
</span>
41-
)}
28+
funcInfo.oop.constructorclass ? null : (
29+
<li>
30+
{funcInfo.oop.method && (
31+
<span style="margin-right: 10px;">
32+
{funcInfo.oop.static ? funcInfo.oop.entity.charAt(0).toUpperCase() + funcInfo.oop.entity.slice(1) : funcInfo.oop.entity}{funcInfo.oop.static ? '.' : ':'}<a href={funcInfo.link} title={funcInfo.name}>{funcInfo.oop.method}</a>(...)
33+
</span>
34+
)}
4235

43-
{funcInfo.oop.variable && (
44-
<span>
45-
<strong>Variable</strong>:
46-
.{funcInfo.oop.variable}
47-
</span>
48-
)}
49-
</>
50-
)}
51-
</li>
36+
{funcInfo.oop.variable && (
37+
<span>
38+
<strong>Variable</strong>:
39+
.{funcInfo.oop.variable}
40+
</span>
41+
)}
42+
</li>
43+
)
5244
))}
5345
</ul>
5446
</section>

web/src/pages/[func].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ let funcSyntaxes = parseFunctionSyntaxes(func.id, func.data);
112112
{funcInfo.oop.constructorclass ? (
113113
<li>
114114
<strong>Constructor</strong>:
115-
{funcInfo.oop.constructorclass}(...)
115+
<a href={`/${funcInfo.oop.entity}`}>{funcInfo.oop.constructorclass}</a>(...)
116116
</li>
117117
) : (
118118
<>

0 commit comments

Comments
 (0)