Skip to content

Commit

Permalink
JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
hasumikin committed Sep 21, 2024
1 parent 455409b commit be9f4fd
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 1 deletion.
20 changes: 20 additions & 0 deletions _data/sidebars/picoruby_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,26 @@ entries:
url: "/IO.html"
output: web pdf
type: homepage
- title: module JSON
url: "/JSON.html"
output: web pdf
type: homepage
- title: module JSON::Common
url: "/JSON_Common.html"
output: web pdf
type: homepage
- title: class JSON::Digger
url: "/JSON_Digger.html"
output: web pdf
type: homepage
- title: class JSON::Generator
url: "/JSON_Generator.html"
output: web pdf
type: homepage
- title: class JSON::Parser
url: "/JSON_Parser.html"
output: web pdf
type: homepage
- title: class MML
url: "/MML.html"
output: web pdf
Expand Down
6 changes: 5 additions & 1 deletion lib/rbs_doc/class_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def format_module(dec, upper_name = [])
[method[:name]]
end
when RBS::AST::Declarations::Module
format_class(member, mod[:namespace])
format_module(member, mod[:namespace])
when RBS::AST::Declarations::Class
format_class(member, mod[:namespace])
when RBS::AST::Declarations::TypeAlias
Expand All @@ -68,7 +68,11 @@ def format_class(dec, upper_name = [])
@info << Hash.new.tap do |klass|
klass[:type] = "class"
klass[:namespace] = upper_name + [dec.name.name]
begin
klass[:super_class] = dec.super_class.name.name if dec.super_class
rescue
binding.irb
end
klass[:methods] = {instance: [], singleton: []}
klass[:type_aliases] = []
klass[:attr_accessors] = []
Expand Down
20 changes: 20 additions & 0 deletions pages/rbs_doc/JSON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: module JSON
keywords: JSON
tags: [module]
summary: JSON module of PicoRuby
sidebar: picoruby_sidebar
permalink: JSON.html
folder: rbs_doc
---
## Singleton methods
### generate

```ruby
JSON.generate(untyped) -> String
```
### parse

```ruby
JSON.parse(String) -> untyped
```
9 changes: 9 additions & 0 deletions pages/rbs_doc/JSON_Common.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: module JSON::Common
keywords: JSON::Common
tags: [module]
summary: JSON::Common module of PicoRuby
sidebar: picoruby_sidebar
permalink: JSON_Common.html
folder: rbs_doc
---
37 changes: 37 additions & 0 deletions pages/rbs_doc/JSON_Digger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: class JSON::Digger
keywords: JSON::Digger
tags: [class]
summary: JSON::Digger class of PicoRuby
sidebar: picoruby_sidebar
permalink: JSON_Digger.html
folder: rbs_doc
---
## Include
[Common](Common.html)
## Type aliases
### dig_key_t
```ruby
String | Integer
```
### stack_t
```ruby
:array | :object
```
## Singleton methods
### new

```ruby
JSON::Digger.new(String) -> void
```
## Instance methods
### dig

```ruby
instance.dig(*dig_key_t) -> self
```
### parse

```ruby
instance.parse() -> untyped
```
23 changes: 23 additions & 0 deletions pages/rbs_doc/JSON_Generator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: class JSON::Generator
keywords: JSON::Generator
tags: [class]
summary: JSON::Generator class of PicoRuby
sidebar: picoruby_sidebar
permalink: JSON_Generator.html
folder: rbs_doc
---
## Include
[Common](Common.html)
## Singleton methods
### new

```ruby
JSON::Generator.new(untyped) -> void
```
## Instance methods
### generate

```ruby
instance.generate(?untyped) -> void
```
23 changes: 23 additions & 0 deletions pages/rbs_doc/JSON_Parser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: class JSON::Parser
keywords: JSON::Parser
tags: [class]
summary: JSON::Parser class of PicoRuby
sidebar: picoruby_sidebar
permalink: JSON_Parser.html
folder: rbs_doc
---
## Include
[Common](Common.html)
## Singleton methods
### new

```ruby
JSON::Parser.new(String) -> void
```
## Instance methods
### parse

```ruby
instance.parse() -> untyped
```
5 changes: 5 additions & 0 deletions pages/rbs_doc/Object.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ instance.inspect() -> String
```ruby
instance.is_a?(untyped) -> bool
```
### loop

```ruby
instance.loop() { () -> void }-> void
```
### nil?

```ruby
Expand Down
20 changes: 20 additions & 0 deletions pages/rbs_doc/String.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,21 @@ instance.*(int n) -> String
```ruby
instance.+(string other_str) -> String
```
### <

```ruby
instance.<(string other) -> bool
```
### <<

```ruby
instance.<<(string | Integer str_or_codepoint) -> String
```
### <=

```ruby
instance.<=(string other) -> bool
```
### <=>

```ruby
Expand All @@ -50,6 +60,16 @@ instance.==(untyped obj) -> bool
```ruby
instance.===(untyped obj) -> bool
```
### >

```ruby
instance.>(string other) -> bool
```
### >=

```ruby
instance.>=(string other) -> bool
```
### []

```ruby
Expand Down

0 comments on commit be9f4fd

Please sign in to comment.