tatara 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +23 -0
- data/Gemfile.lock +2 -2
- data/README.md +4 -0
- data/docs/_config.yml +1 -0
- data/docs/index.md +100 -0
- data/docs/tatara/float.md +425 -0
- data/docs/tatara/float_array.md +256 -0
- data/docs/tatara/float_float_map.md +52 -0
- data/docs/tatara/float_integer_map.md +52 -0
- data/docs/tatara/float_string_map.md +52 -0
- data/docs/tatara/float_vector.md +269 -0
- data/docs/tatara/integer.md +480 -0
- data/docs/tatara/integer_array.md +256 -0
- data/docs/tatara/integer_float_map.md +52 -0
- data/docs/tatara/integer_integer_map.md +52 -0
- data/docs/tatara/integer_string_map.md +52 -0
- data/docs/tatara/integer_vector.md +268 -0
- data/docs/tatara/string.md +223 -0
- data/docs/tatara/string_array.md +254 -0
- data/docs/tatara/string_float_map.md +56 -0
- data/docs/tatara/string_int_map.md +55 -0
- data/docs/tatara/string_string_map.md +55 -0
- data/docs/tatara/string_vector.md +270 -0
- data/ext/tatara/array/array.hpp +60 -0
- data/ext/tatara/float/float.hpp +51 -0
- data/ext/tatara/integer/integer.hpp +67 -0
- data/ext/tatara/string/string.hpp +28 -0
- data/ext/tatara/tatara.cpp +138 -9
- data/ext/tatara/vector/vector.hpp +60 -0
- data/lib/tatara.rb +2 -0
- data/lib/tatara/array/array.rb +37 -0
- data/lib/tatara/tatara_ext.rb +6 -0
- data/lib/tatara/vector/vector.rb +37 -0
- data/lib/tatara/version.rb +1 -1
- metadata +27 -3
@@ -0,0 +1,480 @@
|
|
1
|
+
# Tatara::Integer
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::Integer` is `Integer` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::Integer` can set `val` for `Integer` & `Float`.
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
@i = Tatara::Integer.new
|
10
|
+
@i.val = 10
|
11
|
+
# => Set 10.
|
12
|
+
@i.val = 15.6
|
13
|
+
# => Set 15.
|
14
|
+
```
|
15
|
+
|
16
|
+
But, can not set `String` value.
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
@i = Tatara::Integer.new
|
20
|
+
@i.val = "42"
|
21
|
+
# => Error!
|
22
|
+
```
|
23
|
+
|
24
|
+
## Methods
|
25
|
+
### Tatara::Integer#new
|
26
|
+
|
27
|
+
Create new `Tatara::Integer` instance. And init `value` is `0`
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
@i = Tatara::Integer.new
|
31
|
+
```
|
32
|
+
|
33
|
+
### Tatara::Integer#value
|
34
|
+
|
35
|
+
return `Tatara::Integer` instance value.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
@i = Tatara::Integer.new
|
39
|
+
puts @i.value
|
40
|
+
# => Show `0`
|
41
|
+
```
|
42
|
+
|
43
|
+
### Tatara::Integer#val
|
44
|
+
|
45
|
+
return `Tatara::Integer` instance value.
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
@i = Tatara::Integer.new
|
49
|
+
puts @i.val
|
50
|
+
# => Show `0`
|
51
|
+
```
|
52
|
+
|
53
|
+
### Tatara::Integer#value=
|
54
|
+
|
55
|
+
Set instance value for `Tatara::Integer`.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
@i = Tatara::Integer.new
|
59
|
+
@i.value = 42
|
60
|
+
# => Set 42.
|
61
|
+
```
|
62
|
+
|
63
|
+
### Tatara::Integer#val=
|
64
|
+
|
65
|
+
Set instance value for `Tatara::Integer`.
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
@i = Tatara::Integer.new
|
69
|
+
@i.val = 42
|
70
|
+
# => Set 42.
|
71
|
+
```
|
72
|
+
|
73
|
+
### Tatara::Integer#value+
|
74
|
+
|
75
|
+
Add instance value for `Tatara::Integer`.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
@i = Tatara::Integer.new
|
79
|
+
@i.value = 21
|
80
|
+
puts @i.value + 21
|
81
|
+
# => Value is 42
|
82
|
+
```
|
83
|
+
|
84
|
+
### Tatara::Integer#val+
|
85
|
+
|
86
|
+
Add instance value for `Tatara::Integer`.
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
@i = Tatara::Integer.new
|
90
|
+
@i.value = 21
|
91
|
+
puts @i.val + 21
|
92
|
+
# => Value is 42
|
93
|
+
```
|
94
|
+
|
95
|
+
### Tatara::Integer#value-
|
96
|
+
|
97
|
+
Subtract instance value for `Tatara::Integer`.
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
@i = Tatara::Integer.new
|
101
|
+
@i.value = 21
|
102
|
+
puts @i.value - 21
|
103
|
+
# => Value is 0
|
104
|
+
```
|
105
|
+
|
106
|
+
### Tatara::Integer#val-
|
107
|
+
|
108
|
+
Subtract instance value for `Tatara::Integer`.
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
@i = Tatara::Integer.new
|
112
|
+
@i.value = 21
|
113
|
+
puts @i.val - 21
|
114
|
+
# => Value is 0
|
115
|
+
```
|
116
|
+
|
117
|
+
### Tatara::Integer#value\*
|
118
|
+
|
119
|
+
Multiply instance value for `Tatara::Integer`.
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
@i = Tatara::Integer.new
|
123
|
+
@i.value = 2
|
124
|
+
puts @i.value * 21
|
125
|
+
# => Value is 42
|
126
|
+
```
|
127
|
+
|
128
|
+
### Tatara::Integer#val\*
|
129
|
+
|
130
|
+
Multiply instance value for `Tatara::Integer`.
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
@i = Tatara::Integer.new
|
134
|
+
@i.value = 2
|
135
|
+
puts @i.val * 21
|
136
|
+
# => Value is 42
|
137
|
+
```
|
138
|
+
|
139
|
+
### Tatara::Integer#value/
|
140
|
+
|
141
|
+
Divided instance value for `Tatara::Integer`.
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
@i = Tatara::Integer.new
|
145
|
+
@i.value = 42
|
146
|
+
puts @i.value / 21
|
147
|
+
# => Value is 2
|
148
|
+
```
|
149
|
+
|
150
|
+
### Tatara::Integer#val/
|
151
|
+
|
152
|
+
Divided instance value for `Tatara::Integer`.
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
@i = Tatara::Integer.new
|
156
|
+
@i.value = 42
|
157
|
+
puts @i.val / 21
|
158
|
+
# => Value is 2
|
159
|
+
```
|
160
|
+
|
161
|
+
### Tatara::Integer#value%
|
162
|
+
|
163
|
+
Mod instance value for `Tatara::Integer`.
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
@i = Tatara::Integer.new
|
167
|
+
@i.value = 42
|
168
|
+
puts @i.value % 20
|
169
|
+
# => Value is 2
|
170
|
+
puts @i.value % 42
|
171
|
+
# => Value is 0
|
172
|
+
```
|
173
|
+
|
174
|
+
### Tatara::Integer#val%
|
175
|
+
|
176
|
+
Mod instance value for `Tatara::Integer`.
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
@i = Tatara::Integer.new
|
180
|
+
@i.value = 42
|
181
|
+
puts @i.val % 20
|
182
|
+
# => Value is 2
|
183
|
+
puts @i.val % 42
|
184
|
+
# => Value is 0
|
185
|
+
```
|
186
|
+
|
187
|
+
### Tatara::Integer#value\*\*
|
188
|
+
|
189
|
+
Power instance value for `Tatara::Integer`.
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
@i = Tatara::Integer.new
|
193
|
+
@i.value = 2
|
194
|
+
puts @i.value ** 2
|
195
|
+
# => Value is 4
|
196
|
+
puts @i.value ** 2
|
197
|
+
# => Value is 8
|
198
|
+
```
|
199
|
+
|
200
|
+
### Tatara::Integer#val\*\*
|
201
|
+
|
202
|
+
Power instance value for `Tatara::Integer`.
|
203
|
+
|
204
|
+
```ruby
|
205
|
+
@i = Tatara::Integer.new
|
206
|
+
@i.value = 2
|
207
|
+
puts @i.val ** 2
|
208
|
+
# => Value is 4
|
209
|
+
puts @i.val ** 2
|
210
|
+
# => Value is 8
|
211
|
+
```
|
212
|
+
|
213
|
+
### Tatara::Integer#value+=
|
214
|
+
|
215
|
+
Add and Set instance value for `Tatara::Integer`.
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
@i = Tatara::Integer.new
|
219
|
+
@i.value = 21
|
220
|
+
@i.value += 21
|
221
|
+
# => Value is 42
|
222
|
+
@i.value += 21
|
223
|
+
# => Value is 63
|
224
|
+
```
|
225
|
+
|
226
|
+
### Tatara::Integer#val+=
|
227
|
+
|
228
|
+
Add and Set instance value for `Tatara::Integer`.
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
@i = Tatara::Integer.new
|
232
|
+
@i.value = 21
|
233
|
+
@i.val += 21
|
234
|
+
# => Value is 42
|
235
|
+
@i.val += 21
|
236
|
+
# => Value is 63
|
237
|
+
```
|
238
|
+
|
239
|
+
### Tatara::Integer#value-=
|
240
|
+
|
241
|
+
Subtract and Set instance value for `Tatara::Integer`.
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
@i = Tatara::Integer.new
|
245
|
+
@i.value = 20
|
246
|
+
@i.value -= 10
|
247
|
+
# => Value is 10
|
248
|
+
@i.value -= 5
|
249
|
+
# => Value is 5
|
250
|
+
```
|
251
|
+
|
252
|
+
### Tatara::Integer#val-=
|
253
|
+
|
254
|
+
Subtract and Set instance value for `Tatara::Integer`.
|
255
|
+
|
256
|
+
```ruby
|
257
|
+
@i = Tatara::Integer.new
|
258
|
+
@i.value = 20
|
259
|
+
@i.val -= 10
|
260
|
+
# => Value is 10
|
261
|
+
@i.val -= 5
|
262
|
+
# => Value is 5
|
263
|
+
```
|
264
|
+
|
265
|
+
### Tatara::Integer#value\*=
|
266
|
+
|
267
|
+
Multiply and Set instance value for `Tatara::Integer`.
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
@i = Tatara::Integer.new
|
271
|
+
@i.value = 20
|
272
|
+
@i.value *= 10
|
273
|
+
# => Value is 200
|
274
|
+
@i.value *= 5
|
275
|
+
# => Value is 1000
|
276
|
+
```
|
277
|
+
|
278
|
+
### Tatara::Integer#val\*=
|
279
|
+
|
280
|
+
Multiply and Set instance value for `Tatara::Integer`.
|
281
|
+
|
282
|
+
```ruby
|
283
|
+
@i = Tatara::Integer.new
|
284
|
+
@i.value = 20
|
285
|
+
@i.val *= 10
|
286
|
+
# => Value is 200
|
287
|
+
@i.val *= 5
|
288
|
+
# => Value is 1000
|
289
|
+
```
|
290
|
+
|
291
|
+
### Tatara::Integer#value/=
|
292
|
+
|
293
|
+
Divided and Set instance value for `Tatara::Integer`.
|
294
|
+
|
295
|
+
```ruby
|
296
|
+
@i = Tatara::Integer.new
|
297
|
+
@i.value = 20
|
298
|
+
@i.value /= 5
|
299
|
+
# => Value is 4
|
300
|
+
@i.value /= 2
|
301
|
+
# => Value is 2
|
302
|
+
```
|
303
|
+
|
304
|
+
### Tatara::Integer#val/=
|
305
|
+
|
306
|
+
Divided and Set instance value for `Tatara::Integer`.
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
@i = Tatara::Integer.new
|
310
|
+
@i.value = 20
|
311
|
+
@i.val /= 5
|
312
|
+
# => Value is 4
|
313
|
+
@i.val /= 2
|
314
|
+
# => Value is 2
|
315
|
+
```
|
316
|
+
|
317
|
+
### Tatara::Integer#value%=
|
318
|
+
|
319
|
+
Mod and Set instance value for `Tatara::Integer`.
|
320
|
+
|
321
|
+
```ruby
|
322
|
+
@i = Tatara::Integer.new
|
323
|
+
@i.value = 20
|
324
|
+
@i.value %= 20
|
325
|
+
# => Value is 0
|
326
|
+
@i.value = 20
|
327
|
+
@i.value %= 6
|
328
|
+
# => Value is 2
|
329
|
+
```
|
330
|
+
|
331
|
+
|
332
|
+
### Tatara::Integer#val%=
|
333
|
+
|
334
|
+
Mod and Set instance value for `Tatara::Integer`.
|
335
|
+
|
336
|
+
```ruby
|
337
|
+
@i = Tatara::Integer.new
|
338
|
+
@i.val = 20
|
339
|
+
@i.val %= 20
|
340
|
+
# => Value is 0
|
341
|
+
@i.value = 20
|
342
|
+
@i.value %= 6
|
343
|
+
# => Value is 2
|
344
|
+
```
|
345
|
+
|
346
|
+
### Tatara::Integer#value\*\*=
|
347
|
+
|
348
|
+
Power and Set instance value value for `Tatara::Integer`.
|
349
|
+
|
350
|
+
```ruby
|
351
|
+
@i = Tatara::Integer.new
|
352
|
+
@i.value = 2
|
353
|
+
@i.value **= 2
|
354
|
+
# => Value is 4
|
355
|
+
@i.value **= 2
|
356
|
+
# => Value is 16
|
357
|
+
```
|
358
|
+
|
359
|
+
### Tatara::Integer#val\*\*=
|
360
|
+
|
361
|
+
Power and Set instance value value for `Tatara::Integer`.
|
362
|
+
|
363
|
+
```ruby
|
364
|
+
@i = Tatara::Integer.new
|
365
|
+
@i.value = 2
|
366
|
+
@i.val **= 2
|
367
|
+
# => Value is 4
|
368
|
+
@i.val **= 2
|
369
|
+
# => Value is 16
|
370
|
+
```
|
371
|
+
|
372
|
+
### Tatara::Integer#value==
|
373
|
+
|
374
|
+
Check instance value, and return `Boolean`.
|
375
|
+
|
376
|
+
```ruby
|
377
|
+
@i = Tatara::Integer.new
|
378
|
+
@i.value = 42
|
379
|
+
puts @i.value == 42
|
380
|
+
# => true
|
381
|
+
puts @i.value == 62
|
382
|
+
# => false
|
383
|
+
```
|
384
|
+
|
385
|
+
### Tatara::Integer#val==
|
386
|
+
|
387
|
+
Check instance value, and return `Boolean`.
|
388
|
+
|
389
|
+
```ruby
|
390
|
+
@i = Tatara::Integer.new
|
391
|
+
@i.val = 42
|
392
|
+
puts @i.val == 42
|
393
|
+
# => true
|
394
|
+
puts @i.val == 62
|
395
|
+
# => false
|
396
|
+
```
|
397
|
+
|
398
|
+
### Tatara::Integer#inc
|
399
|
+
|
400
|
+
Increment for instance value.
|
401
|
+
|
402
|
+
```ruby
|
403
|
+
@i = Tatara::Integer.new
|
404
|
+
@i.val = 1
|
405
|
+
@i.inc
|
406
|
+
# => Increment instance value
|
407
|
+
puts @i.val
|
408
|
+
# => 2
|
409
|
+
```
|
410
|
+
|
411
|
+
### Tatara::Integer#dec
|
412
|
+
|
413
|
+
Decrement for instance value.
|
414
|
+
|
415
|
+
```ruby
|
416
|
+
@i = Tatara::Integer.new
|
417
|
+
@i.val = 1
|
418
|
+
@i.dec
|
419
|
+
# => Increment instance value
|
420
|
+
puts @i.val
|
421
|
+
# => 0
|
422
|
+
```
|
423
|
+
|
424
|
+
### Tatara::Integer#to_s
|
425
|
+
|
426
|
+
Convert to `String` for instance value.
|
427
|
+
|
428
|
+
```ruby
|
429
|
+
@i = Tatara::Integer.new
|
430
|
+
@i.val = 42
|
431
|
+
@i.to_s
|
432
|
+
# => Conver to String.
|
433
|
+
```
|
434
|
+
|
435
|
+
### Tatara::Integer#to_f
|
436
|
+
|
437
|
+
Convert to `Float` for instance value.
|
438
|
+
|
439
|
+
```ruby
|
440
|
+
@i = Tatara::Integer.new
|
441
|
+
@i.val = 42
|
442
|
+
@i.to_f
|
443
|
+
# => Conver to Float.
|
444
|
+
```
|
445
|
+
|
446
|
+
### Tatara::Integer#clear
|
447
|
+
|
448
|
+
Clear instance value.
|
449
|
+
|
450
|
+
```ruby
|
451
|
+
@i = Tatara::Integer.new
|
452
|
+
@i.val = 42
|
453
|
+
# => Set 42
|
454
|
+
@i.clear
|
455
|
+
# => Clear instance value. Value is 0
|
456
|
+
```
|
457
|
+
|
458
|
+
### Tatara::Integer#equal?
|
459
|
+
|
460
|
+
Check instance value, and return `Boolean`
|
461
|
+
|
462
|
+
```ruby
|
463
|
+
@i = Tatara::Integer.new
|
464
|
+
@i.val = 42
|
465
|
+
puts @i.equal? 42
|
466
|
+
# => true
|
467
|
+
```
|
468
|
+
|
469
|
+
### Tatara::Integer#operator<<
|
470
|
+
|
471
|
+
Set instance value for `Tatara::Integer`.
|
472
|
+
|
473
|
+
```ruby
|
474
|
+
@i = Tatara::Integer.new << 42
|
475
|
+
puts @i.val
|
476
|
+
# => 42
|
477
|
+
@i = @i << 50
|
478
|
+
puts @i.val
|
479
|
+
# => 50
|
480
|
+
```
|