Skip to content

Commit b3f9aad

Browse files
Reduce private API descriptions from generated documents
1 parent 4c0e801 commit b3f9aad

File tree

2 files changed

+13
-37
lines changed

2 files changed

+13
-37
lines changed

packages/npm-packages/ruby-head-wasm-wasi/README.md

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,15 @@ jnode.setRNode(rnode);
134134
- [wrap](#wrap)
135135
- [Parameters](#parameters-4)
136136
- [Examples](#examples-2)
137-
- [JsValueTransport](#jsvaluetransport)
138137
- [RbValue](#rbvalue)
139-
- [Parameters](#parameters-5)
140138
- [call](#call)
141-
- [Parameters](#parameters-6)
139+
- [Parameters](#parameters-5)
142140
- [Examples](#examples-3)
143141
- [toPrimitive](#toprimitive)
144-
- [Parameters](#parameters-7)
142+
- [Parameters](#parameters-6)
145143
- [toString](#tostring)
146144
- [toJS](#tojs)
147145
- [RbError](#rberror)
148-
- [Parameters](#parameters-8)
149146

150147
### RubyVM
151148

@@ -237,37 +234,10 @@ hash.call("store", vm.eval(`"key1"`), vm.wrap(new Object()));
237234

238235
Returns **any** the RbValue object representing the given JS value
239236

240-
### JsValueTransport
241-
242-
Export a JS value held by the Ruby VM to the JS environment.
243-
This is implemented in a dirty way since wit cannot reference resources
244-
defined in other interfaces.
245-
In our case, we can't express `function(v: rb-abi-value) -> js-abi-value`
246-
because `rb-js-abi-host.wit`, that defines `js-abi-value`, is implemented
247-
by embedder side (JS) but `rb-abi-guest.wit`, that defines `rb-abi-value`
248-
is implemented by guest side (Wasm).
249-
250-
This class is a helper to export by:
251-
252-
1. Call `function __export_to_js(v: rb-abi-value)` defined in guest from embedder side.
253-
2. Call `function takeJsValue(v: js-abi-value)` defined in embedder from guest side with
254-
underlying JS value of given `rb-abi-value`.
255-
3. Then `takeJsValue` implementation escapes the given JS value to the `_takenJsValues`
256-
stored in embedder side.
257-
4. Finally, embedder side can take `_takenJsValues`.
258-
259-
Note that `exportJsValue` is not reentrant.
260-
261237
### RbValue
262238

263239
A RbValue is an object that represents a value in Ruby
264240

265-
#### Parameters
266-
267-
- `inner`
268-
- `vm`
269-
- `privateObject`
270-
271241
#### call
272242

273243
Call a given method with given arguments
@@ -291,7 +261,7 @@ console.log(ary.call("sample").toString());
291261

292262
##### Parameters
293263

294-
- `hint`
264+
- `hint` Preferred type of the result primitive value. `"number"`, `"string"`, or `"default"`.
295265

296266
#### toString
297267

@@ -310,10 +280,6 @@ Returns null if the value is not convertible to a JavaScript object.
310280

311281
Error class thrown by Ruby execution
312282

313-
#### Parameters
314-
315-
- `message`
316-
317283
## Building the package from source
318284

319285
The instructions for building a Ruby targeting WebAssembly are available [here](https://github.com/ruby/ruby.wasm#building-from-source).

packages/npm-packages/ruby-wasm-wasi/src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ export class RubyVM {
243243
* 4. Finally, embedder side can take `_takenJsValues`.
244244
*
245245
* Note that `exportJsValue` is not reentrant.
246+
*
247+
* @private
246248
*/
247249
class JsValueTransport {
248250
private _takenJsValue: JsAbiValue = null;
@@ -271,6 +273,10 @@ class JsValueTransport {
271273
* A RbValue is an object that represents a value in Ruby
272274
*/
273275
export class RbValue {
276+
277+
/**
278+
* @hideconstructor
279+
*/
274280
constructor(
275281
private inner: RbAbi.RbAbiValue,
276282
private vm: RubyVM,
@@ -300,6 +306,7 @@ export class RbValue {
300306

301307
/**
302308
* @see {@link https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toPrimitive}
309+
* @param hint Preferred type of the result primitive value. `"number"`, `"string"`, or `"default"`.
303310
*/
304311
[Symbol.toPrimitive](hint: string) {
305312
if (hint === "string" || hint === "default") {
@@ -454,6 +461,9 @@ const evalRbCode = (vm: RubyVM, privateObject: RubyVMPrivate, code: string) => {
454461
* Error class thrown by Ruby execution
455462
*/
456463
export class RbError extends Error {
464+
/**
465+
* @hideconstructor
466+
*/
457467
constructor(message: string) {
458468
super(message);
459469
}

0 commit comments

Comments
 (0)