Skip to content

Commit 7070c99

Browse files
committed
docs: standardize array type syntax to Type[] format (ja, ko)
Replace Array<Type> with Type[] shorthand syntax throughout Japanese and Korean documentation for consistency. Exceptions preserved: - Hash<K, V> types unchanged - Type alias names (ReadonlyArray<T>, IsArray<T>) - Generic syntax explanation tables - Constructor syntax (Array<User>.new)
1 parent 3f07ecd commit 7070c99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+398
-398
lines changed

docs/project/changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ trc run hello.trb
6363
```trb
6464
# Array shorthand syntax
6565
def process(items: String[]): Integer[][]
66-
# items is Array<String>
67-
# returns Array<Array<Integer>>
66+
# items is String[]
67+
# returns Integer[][]
6868
end
6969
7070
# Equivalent to

i18n/ja/docusaurus-plugin-content-docs/current/cli/compiler-options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ trc compile --strict src/
3939

4040
```trb
4141
# 厳格モードでは完全な型指定が必要
42-
def process(data: Array<String>): Hash<String, Integer>
42+
def process(data: String[]): Hash<String, Integer>
4343
@count: Integer = 0
4444
result: Hash<String, Integer> = {}
4545
result
@@ -138,7 +138,7 @@ trc compile --no-unchecked-indexed-access src/
138138

139139
```trb
140140
# --no-unchecked-indexed-access使用時はエラー
141-
users: Array<User> = get_users()
141+
users: User[] = get_users()
142142
user = users[0] # エラー: nilの可能性あり
143143
144144
# まず検査が必要

i18n/ja/docusaurus-plugin-content-docs/current/cli/configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ compiler:
256256

257257
```trb
258258
# 厳格モードで必要
259-
def process(data: Array<String>): Hash<String, Integer>
259+
def process(data: String[]): Hash<String, Integer>
260260
@count: Integer = 0
261261
result: Hash<String, Integer> = {}
262262
# ...
@@ -272,7 +272,7 @@ end
272272

273273
```trb
274274
# 標準モードでOK
275-
def process(data: Array<String>): Hash<String, Integer>
275+
def process(data: String[]): Hash<String, Integer>
276276
@count: Integer = 0
277277
result = {} # 型を推論
278278
# ...
@@ -412,7 +412,7 @@ end
412412

413413
```trb
414414
# no_unchecked_indexed_access: trueの場合エラー
415-
users: Array<User> = get_users()
415+
users: User[] = get_users()
416416
user = users[0] # エラー: nilの可能性あり
417417
418418
# OK - まず検査

i18n/ja/docusaurus-plugin-content-docs/current/getting-started/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ is_active: Boolean = true
8282
role: Symbol = :admin
8383
8484
# コレクション
85-
numbers: Array<Integer> = [1, 2, 3, 4, 5]
85+
numbers: Integer[] = [1, 2, 3, 4, 5]
8686
scores: Hash<String, Integer> = { "数学" => 100, "英語" => 95 }
8787
8888
# Nil許容(オプショナル)

i18n/ja/docusaurus-plugin-content-docs/current/getting-started/understanding-trb-files.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Calculatorクラスを作成しましょう:
134134
```trb title="calculator.trb"
135135
class Calculator
136136
# 型アノテーション付きインスタンス変数
137-
@history: Array<String>
137+
@history: String[]
138138
139139
def initialize: void
140140
@history = []
@@ -168,7 +168,7 @@ class Calculator
168168
result
169169
end
170170
171-
def history: Array<String>
171+
def history: String[]
172172
@history.dup
173173
end
174174
@@ -272,7 +272,7 @@ def find(id: Integer): User? # 短縮形
272272
### ブロックパラメータ
273273

274274
```rbs
275-
def each_item(items: Array<String>, &block: (String) -> void): void
275+
def each_item(items: String[], &block: (String) -> void): void
276276
items.each(&block)
277277
end
278278
@@ -314,7 +314,7 @@ Error: calculator.trb:2:15
314314

315315
1. **パブリックAPIから始める** - パブリックメソッドに最初に型を付ける
316316
2. **型エイリアスを使用** - 複雑な型を読みやすくする
317-
3. **具体的な型を優先** - `Array`より`Array<String>`
317+
3. **具体的な型を優先** - `Array`より`String[]`
318318
4. **型でドキュメント化** - 型はドキュメントとして機能する
319319

320320
## 次のステップ

i18n/ja/docusaurus-plugin-content-docs/current/introduction/t-ruby-vs-others.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class Calculator
128128
a + b
129129
end
130130
131-
def join(items: Array<String>): String
131+
def join(items: String[]): String
132132
items.join(", ")
133133
end
134134
end

i18n/ja/docusaurus-plugin-content-docs/current/introduction/what-is-t-ruby.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ id: String | Integer = "user-123"
5252
name: String? = nil
5353
5454
# ジェネリクス
55-
users: Array<User> = []
55+
users: User[] = []
5656
5757
# インターフェース
5858
interface Printable

i18n/ja/docusaurus-plugin-content-docs/current/introduction/why-t-ruby.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def transform(data, options = {})
7272
end
7373
7474
# 型あり - 明確
75-
def transform(data: Array<Record>, options: TransformOptions?): TransformResult
75+
def transform(data: Record[], options: TransformOptions?): TransformResult
7676
# ...
7777
end
7878
```
@@ -148,7 +148,7 @@ T-Rubyは特に以下の場合に価値があります:
148148
puts "Hello, #{ARGV[0]}!"
149149
150150
# これは不要:
151-
# def main(args: Array<String>): void
151+
# def main(args: String[]): void
152152
# puts "Hello, #{args[0]}!"
153153
# end
154154
```

i18n/ja/docusaurus-plugin-content-docs/current/learn/advanced/intersection-types.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ end
162162
163163
interface Validatable
164164
def valid?: Boolean
165-
def errors: Array<String>
165+
def errors: String[]
166166
end
167167
168168
interface Persistable
@@ -179,7 +179,7 @@ class Article
179179
180180
@title: String
181181
@content: String
182-
@errors: Array<String>
182+
@errors: String[]
183183
184184
def initialize(title: String, content: String): void
185185
@title = title
@@ -203,7 +203,7 @@ class Article
203203
@errors.empty?
204204
end
205205
206-
def errors: Array<String>
206+
def errors: String[]
207207
@errors
208208
end
209209
@@ -248,7 +248,7 @@ type BaseEntity = Identifiable & Timestamped
248248
type DeletableEntity = Identifiable & Timestamped & SoftDeletable
249249
250250
class Repository<T: BaseEntity>
251-
@items: Array<T>
251+
@items: T[]
252252
253253
def initialize: void
254254
@items = []
@@ -258,25 +258,25 @@ class Repository<T: BaseEntity>
258258
@items.find { |item| item.id == id }
259259
end
260260
261-
def all: Array<T>
261+
def all: T[]
262262
@items.dup
263263
end
264264
265-
def recent(limit: Integer = 10): Array<T>
265+
def recent(limit: Integer = 10): T[]
266266
@items.sort_by { |item| item.created_at }.reverse.take(limit)
267267
end
268268
end
269269
270270
class SoftDeleteRepository<T: DeletableEntity> < Repository<T>
271-
def all: Array<T>
271+
def all: T[]
272272
@items.reject { |item| item.deleted? }
273273
end
274274
275-
def with_deleted: Array<T>
275+
def with_deleted: T[]
276276
@items.dup
277277
end
278278
279-
def only_deleted: Array<T>
279+
def only_deleted: T[]
280280
@items.select { |item| item.deleted? }
281281
end
282282
end
@@ -428,7 +428,7 @@ end
428428
429429
# 複数の機能を必要とするコレクション
430430
class ValidatedCollection<T: Identifiable & Validatable>
431-
@items: Array<T>
431+
@items: T[]
432432
433433
def initialize: void
434434
@items = []
@@ -447,11 +447,11 @@ class ValidatedCollection<T: Identifiable & Validatable>
447447
@items.find { |item| item.id == id }
448448
end
449449
450-
def all_valid: Array<T>
450+
def all_valid: T[]
451451
@items.select { |item| item.valid? }
452452
end
453453
454-
def all_invalid: Array<T>
454+
def all_invalid: T[]
455455
@items.reject { |item| item.valid? }
456456
end
457457
end
@@ -638,7 +638,7 @@ class FormBuilder
638638
implements Buildable, Validatable, Resettable
639639
640640
@fields: Hash<String, String>
641-
@errors: Array<String>
641+
@errors: String[]
642642
643643
def initialize: void
644644
@fields = {}
@@ -690,9 +690,9 @@ class WorkflowState
690690
implements State, Transitionable, Observable
691691
692692
@name: String
693-
@allowed_transitions: Array<String>
693+
@allowed_transitions: String[]
694694
695-
def initialize(name: String, allowed_transitions: Array<String>): void
695+
def initialize(name: String, allowed_transitions: String[]): void
696696
@name = name
697697
@allowed_transitions = allowed_transitions
698698
end

i18n/ja/docusaurus-plugin-content-docs/current/learn/basics/basic-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ speed_of_light: Float = 2.998e8 # 299,800,000
175175
### Float算術
176176

177177
```trb title="float_math.trb"
178-
def calculate_average(values: Array<Float>): Float
178+
def calculate_average(values: Float[]): Float
179179
sum = 0.0
180180
values.each do |v|
181181
sum += v

0 commit comments

Comments
 (0)