raysetta 0.1.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.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +72 -0
  4. data/Rakefile +8 -0
  5. data/Steepfile +15 -0
  6. data/exe/raysetta +3 -0
  7. data/lib/raysetta/aabb.rb +116 -0
  8. data/lib/raysetta/background/base.rb +19 -0
  9. data/lib/raysetta/background/cube_map.rb +44 -0
  10. data/lib/raysetta/background/gradient.rb +28 -0
  11. data/lib/raysetta/background/solid.rb +24 -0
  12. data/lib/raysetta/background/sphere_map.rb +30 -0
  13. data/lib/raysetta/camera.rb +109 -0
  14. data/lib/raysetta/entity_base.rb +28 -0
  15. data/lib/raysetta/exe.rb +75 -0
  16. data/lib/raysetta/hit.rb +38 -0
  17. data/lib/raysetta/image.rb +46 -0
  18. data/lib/raysetta/interval.rb +63 -0
  19. data/lib/raysetta/material/base.rb +19 -0
  20. data/lib/raysetta/material/dielectric.rb +60 -0
  21. data/lib/raysetta/material/diffuse_light.rb +42 -0
  22. data/lib/raysetta/material/lambertian.rb +48 -0
  23. data/lib/raysetta/material/metal.rb +49 -0
  24. data/lib/raysetta/object/base.rb +23 -0
  25. data/lib/raysetta/object/box.rb +50 -0
  26. data/lib/raysetta/object/bvh.rb +81 -0
  27. data/lib/raysetta/object/group.rb +59 -0
  28. data/lib/raysetta/object/moving_sphere.rb +41 -0
  29. data/lib/raysetta/object/quad.rb +88 -0
  30. data/lib/raysetta/object/sphere.rb +68 -0
  31. data/lib/raysetta/object/tri.rb +46 -0
  32. data/lib/raysetta/output/base.rb +23 -0
  33. data/lib/raysetta/output/png.rb +26 -0
  34. data/lib/raysetta/output/ppm.rb +19 -0
  35. data/lib/raysetta/perlin.rb +91 -0
  36. data/lib/raysetta/ray.rb +28 -0
  37. data/lib/raysetta/runner/base.rb +28 -0
  38. data/lib/raysetta/runner/concurrent.rb +17 -0
  39. data/lib/raysetta/runner/processes.rb +26 -0
  40. data/lib/raysetta/runner/ractors.rb +32 -0
  41. data/lib/raysetta/runner/sync.rb +28 -0
  42. data/lib/raysetta/runner/threads.rb +26 -0
  43. data/lib/raysetta/runner.rb +45 -0
  44. data/lib/raysetta/scatter.rb +12 -0
  45. data/lib/raysetta/scene.rb +205 -0
  46. data/lib/raysetta/texture/base.rb +19 -0
  47. data/lib/raysetta/texture/checker.rb +55 -0
  48. data/lib/raysetta/texture/image.rb +57 -0
  49. data/lib/raysetta/texture/noise.rb +46 -0
  50. data/lib/raysetta/texture/solid_color.rb +36 -0
  51. data/lib/raysetta/tracer.rb +43 -0
  52. data/lib/raysetta/util.rb +38 -0
  53. data/lib/raysetta/vec2.rb +125 -0
  54. data/lib/raysetta/vec3.rb +214 -0
  55. data/lib/raysetta/version.rb +5 -0
  56. data/lib/raysetta.rb +44 -0
  57. data/mise.toml +2 -0
  58. data/scenes/box.json +26 -0
  59. data/scenes/cornell.json +108 -0
  60. data/scenes/cubemap.json +109 -0
  61. data/scenes/dumb.json +58 -0
  62. data/scenes/earth.json +79 -0
  63. data/scenes/example.json +11712 -0
  64. data/scenes/perlin.json +2126 -0
  65. data/scenes/quads.json +38 -0
  66. data/scenes/simple_light.json +2126 -0
  67. data/scenes/testcube.json +113 -0
  68. data/sig/raysetta/aabb.rbs +39 -0
  69. data/sig/raysetta/background/base.rbs +11 -0
  70. data/sig/raysetta/background/cube_map.rbs +9 -0
  71. data/sig/raysetta/background/gradient.rbs +10 -0
  72. data/sig/raysetta/background/solid.rbs +9 -0
  73. data/sig/raysetta/background/sphere_map.rbs +9 -0
  74. data/sig/raysetta/camera.rbs +41 -0
  75. data/sig/raysetta/entity_base.rbs +12 -0
  76. data/sig/raysetta/hit.rbs +21 -0
  77. data/sig/raysetta/image.rbs +13 -0
  78. data/sig/raysetta/interval.rbs +36 -0
  79. data/sig/raysetta/material/base.rbs +11 -0
  80. data/sig/raysetta/material/dielectric.rbs +15 -0
  81. data/sig/raysetta/material/diffuse_light.rbs +12 -0
  82. data/sig/raysetta/material/lambertian.rbs +10 -0
  83. data/sig/raysetta/material/metal.rbs +11 -0
  84. data/sig/raysetta/object/base.rbs +15 -0
  85. data/sig/raysetta/object/box.rbs +13 -0
  86. data/sig/raysetta/object/bvh.rbs +23 -0
  87. data/sig/raysetta/object/group.rbs +16 -0
  88. data/sig/raysetta/object/moving_sphere.rbs +15 -0
  89. data/sig/raysetta/object/quad.rbs +26 -0
  90. data/sig/raysetta/object/sphere.rbs +14 -0
  91. data/sig/raysetta/object/tri.rbs +15 -0
  92. data/sig/raysetta/output/base.rbs +15 -0
  93. data/sig/raysetta/output/png.rbs +8 -0
  94. data/sig/raysetta/output/ppm.rbs +7 -0
  95. data/sig/raysetta/perlin.rbs +19 -0
  96. data/sig/raysetta/ray.rbs +18 -0
  97. data/sig/raysetta/runner/base.rbs +15 -0
  98. data/sig/raysetta/runner/concurrent.rbs +10 -0
  99. data/sig/raysetta/runner/processes.rbs +9 -0
  100. data/sig/raysetta/runner/ractors.rbs +11 -0
  101. data/sig/raysetta/runner/sync.rbs +11 -0
  102. data/sig/raysetta/runner/threads.rbs +9 -0
  103. data/sig/raysetta/runner.rbs +5 -0
  104. data/sig/raysetta/scatter.rbs +8 -0
  105. data/sig/raysetta/scene.rbs +69 -0
  106. data/sig/raysetta/texture/base.rbs +11 -0
  107. data/sig/raysetta/texture/checker.rbs +15 -0
  108. data/sig/raysetta/texture/image.rbs +11 -0
  109. data/sig/raysetta/texture/noise.rbs +13 -0
  110. data/sig/raysetta/texture/solid_color.rbs +10 -0
  111. data/sig/raysetta/tracer.rbs +16 -0
  112. data/sig/raysetta/util.rbs +15 -0
  113. data/sig/raysetta/vec2.rbs +48 -0
  114. data/sig/raysetta/vec3.rbs +67 -0
  115. data/sig/raysetta.rbs +6 -0
  116. data/sig/stdlib/chunky_png.rbs +24 -0
  117. data/sig/stdlib/etc.rbs +3 -0
  118. data/sig/stdlib/json.rbs +3 -0
  119. data/sig/stdlib/optparse.rbs +4 -0
  120. data/sig/stdlib/parallel.rbs +5 -0
  121. data/sig/stdlib/progress.rbs +5 -0
  122. metadata +206 -0
@@ -0,0 +1,14 @@
1
+ module Raysetta
2
+ module Object
3
+ class Sphere < Base
4
+ attr_accessor center: Vec3
5
+ attr_accessor radius: Float
6
+ attr_accessor material: Material::Base
7
+ attr_reader bounding_box: AABB
8
+
9
+ def initialize: (Vec3 center, Float radius, Material::Base material) -> void
10
+
11
+ def hit: (Ray r, Range[Float] ray_t, ?Vec3 center) -> Hit?
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module Raysetta
2
+ module Object
3
+ class Tri < Quad
4
+ # Compute the bounding box of all three vertices.
5
+ @bounding_box: AABB
6
+
7
+ def initialize: (Vec3 a, Vec3 b, Vec3 c, Material::Base material) -> void
8
+
9
+ private
10
+
11
+ def interior?: (Float a, Float b) -> Vec2?
12
+ def compute_bounding_box: () -> AABB
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Raysetta
2
+ module Output
3
+ class Base
4
+ type pixel = [Integer, Integer, Integer]
5
+ attr_reader pixels: Array[Array[pixel]]
6
+ attr_reader width: Integer
7
+ attr_reader height: Integer
8
+
9
+ def initialize: (Array[Array[pixel]] pixels, width: Integer, height: Integer) -> void
10
+
11
+ def call: () -> untyped
12
+ def save: (String file) -> void
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ module Raysetta
2
+ module Output
3
+ class PNG < Base
4
+ def call: () -> ChunkyPNG::Image
5
+ def save: (String file) -> void
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Raysetta
2
+ module Output
3
+ class PPM < Base
4
+ def call: () -> String
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ module Raysetta
2
+ class Perlin < EntityBase
3
+ attr_accessor randvec: Array[Vec3]
4
+ attr_accessor perm_x: Array[Integer]
5
+ attr_accessor perm_y: Array[Integer]
6
+ attr_accessor perm_z: Array[Integer]
7
+
8
+ POINT_COUNT: 256
9
+
10
+ def initialize: (?Array[Vec3] randvec, ?Array[Integer] perm_x, ?Array[Integer] perm_y, ?Array[Integer] perm_z) -> void
11
+
12
+ def noise: (Vec3 point) -> Float
13
+ def turb: (Vec3 point, Integer depth) -> Float
14
+
15
+ def self.perlin_interp: (Array[Array[Array[Vec3]]] c, Vec3 vec) -> Float
16
+
17
+ CUBE: Array[[Integer, Integer, Integer]]
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module Raysetta
2
+ class Ray
3
+ attr_accessor origin: Vec3
4
+ attr_accessor direction: Vec3
5
+ attr_accessor time: Float
6
+
7
+ def initialize: (Vec3 origin, Vec3 direction, ?Float time) -> void
8
+
9
+ def at: (Float t) -> Vec3
10
+
11
+ def dup: () -> instance
12
+
13
+ def ==: (untyped r) -> bool
14
+ alias eql? ==
15
+
16
+ def hash: () -> Integer
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ module Raysetta
2
+ module Runner
3
+ type output = Array[Array[Output::Base::pixel]]
4
+
5
+ class Base
6
+ attr_reader tracer: Tracer
7
+
8
+ def initialize: (Tracer tracer) -> void
9
+
10
+ def call: () -> void
11
+ def progress: () -> void
12
+ def finish: () -> void
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ module Raysetta
2
+ module Runner
3
+ class Concurrent < Base
4
+ attr_reader count: Integer
5
+ attr_reader output: output
6
+
7
+ def initialize: (Tracer tracer, ?count: Integer) -> void
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Raysetta
2
+ module Runner
3
+ class Processes < Concurrent
4
+ attr_reader output: output
5
+
6
+ def call: () -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Raysetta
2
+ module Runner
3
+ class Ractors < Concurrent
4
+ attr_reader output: output
5
+
6
+ def call: () -> void
7
+
8
+ def self.run: ([Integer, Tracer]) -> Array[Output::Base::pixel]
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Raysetta
2
+ module Runner
3
+ class Sync < Base
4
+ attr_reader output: output
5
+
6
+ def initialize: (Tracer tracer) -> void
7
+
8
+ def call: () -> void
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module Raysetta
2
+ module Runner
3
+ class Threads < Concurrent
4
+ attr_reader output: output
5
+
6
+ def call: () -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Raysetta
2
+ module Runner
3
+ def self.parse_scene: (String input_path, ?output_path: String?, ?runner: Symbol, ?format: Symbol, ?concurrency: Integer, **untyped options) -> void
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ module Raysetta
2
+ class Scatter
3
+ attr_accessor ray: Ray
4
+ attr_accessor attenuation: Vec3
5
+
6
+ def initialize: (Ray ray, Vec3 attenuation) -> void
7
+ end
8
+ end
@@ -0,0 +1,69 @@
1
+ module Raysetta
2
+ class Scene
3
+ type json = Hash[String, Hash[String, Hash[String, untyped]]]
4
+
5
+ attr_accessor world: Object::Base
6
+ attr_accessor camera: Camera
7
+ attr_accessor background: Background::Base
8
+
9
+ def initialize: (Object::Base world, Camera camera, Background::Base background) -> void
10
+
11
+ def self.parse: (json json) -> Scene
12
+
13
+ def export: () -> Hash[Symbol, untyped]
14
+
15
+ private
16
+
17
+ interface _Exportable
18
+ def id: () -> String
19
+ def export: () -> Hash[Symbol, untyped]
20
+ end
21
+
22
+ def export_by_id: (Array[_Exportable] entities) -> Hash[String, Hash[Symbol, untyped]]
23
+
24
+ class Parser
25
+ @noises: Hash[String, Perlin]
26
+ @images: Hash[String, Image]
27
+ @textures: Hash[String, Texture::Base]
28
+ @materials: Hash[String, Material::Base]
29
+
30
+ class Error < Raysetta::Error
31
+ end
32
+
33
+ attr_reader json: json
34
+
35
+ def initialize: (json json) -> void
36
+
37
+ def parse: () -> Scene
38
+
39
+ def parse_noise: (Hash[String, untyped] noise) -> Perlin
40
+ def parse_image: (Hash[String, untyped] img) -> Image
41
+ def parse_texture: (Hash[String, untyped] tex) -> Texture::Base
42
+ def parse_material: (Hash[String, untyped] mat) -> Material::Base
43
+ def parse_world: (Hash[String, Hash[String, untyped]] json) -> Object::Base
44
+
45
+ def parse_object: (Hash[String, untyped] obj) -> Object::Base
46
+ def parse_sphere: (Hash[String, untyped] obj) -> Object::Sphere
47
+ def parse_moving_sphere: (Hash[String, untyped] obj) -> Object::MovingSphere
48
+ def parse_quad: (Hash[String, untyped] obj) -> Object::Quad
49
+ def parse_tri: (Hash[String, untyped] obj) -> Object::Tri
50
+ def parse_box: (Hash[String, untyped] obj) -> Object::Box
51
+
52
+ def material: (String name) -> Material::Base
53
+ def texture: (String name) -> Texture::Base
54
+ def image: (String name) -> Image
55
+ def noise: (String name) -> Perlin
56
+
57
+ def parse_camera: (Hash[String, untyped] cam) -> Camera
58
+ def parse_background: (Hash[String, untyped] bg) -> Background::Base
59
+ def parse_solid_bg: (Hash[String, untyped] bg) -> Background::Solid
60
+ def parse_gradient_bg: (Hash[String, untyped] bg) -> Background::Gradient
61
+ def parse_sphere_map: (Hash[String, untyped] bg) -> Background::SphereMap
62
+ def parse_cube_map: (Hash[String, untyped] bg) -> Background::CubeMap
63
+
64
+ def vec2: (Array[Float]) -> Vec2
65
+ def vec3: (Array[Float]) -> Vec3
66
+ alias rgb vec3
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,11 @@
1
+ module Raysetta
2
+ module Texture
3
+ class Base < EntityBase
4
+ def sample: (Vec2 uv, Vec3 point) -> Vec3
5
+
6
+ def export: () -> Hash[Symbol, untyped]
7
+ def images: () -> Array[Image]
8
+ def noises: () -> Array[Perlin]
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module Raysetta
2
+ module Texture
3
+ class Checker < Base
4
+ attr_accessor inv_scale: Float
5
+ attr_accessor even: Texture::Base
6
+ attr_accessor odd: Texture::Base
7
+
8
+ def initialize: (Float scale, Texture::Base even, Texture::Base odd) -> void
9
+ def self.solid: (Float scale, Vec3 even, Vec3 odd) -> instance
10
+
11
+ def scale=: (Float scale) -> Float
12
+ def scale: () -> Float
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ module Raysetta
2
+ module Texture
3
+ class Image < Base
4
+ attr_accessor image: Raysetta::Image
5
+
6
+ def initialize: (Raysetta::Image image) -> void
7
+
8
+ def images: () -> [Raysetta::Image]
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ module Raysetta
2
+ module Texture
3
+ class Noise < Base
4
+ attr_accessor scale: Float
5
+ attr_accessor depth: Integer
6
+ attr_accessor marble_axis: Symbol
7
+
8
+ def initialize: (Float scale, Integer depth, Symbol marble_axis, ?Perlin noise) -> void
9
+
10
+ attr_reader noise: Perlin
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ module Raysetta
2
+ module Texture
3
+ class SolidColor < Base
4
+ attr_accessor albedo: Vec3
5
+
6
+ def initialize: (Vec3 albedo) -> void
7
+ def self.rgb: (Float r, Float g, Float b) -> instance
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ module Raysetta
2
+ class Tracer
3
+ @pixel_sample_scale: Float
4
+
5
+ attr_reader scene: Scene
6
+ attr_reader width: Integer
7
+ attr_reader height: Integer
8
+ attr_reader samples_per_pixel: Integer
9
+ attr_reader max_depth: Integer
10
+
11
+ def initialize: (Scene scene, ?width: Integer, ?height: Integer, ?samples_per_pixel: Integer, ?max_depth: Integer) -> void
12
+
13
+ def call: (Integer x, Integer y) -> [Integer, Integer, Integer]
14
+ def ray_color: (Ray r, ?Integer depth) -> Vec3
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ module Raysetta
2
+ module Util
3
+ EPSILON: Float
4
+
5
+ def self.degrees_to_radians: (Float degrees) -> Float
6
+
7
+ # Returns a random real in [min,max).
8
+ def self.random: (Float min, Float max) -> Float
9
+
10
+ def self.linear_to_gamma: (Float linear_component) -> Float
11
+ def self.gamma_to_linear: (Float gamma_component, ?Float gamma) -> Float
12
+
13
+ def self.sphere_uv: (Vec3 point) -> Vec2
14
+ end
15
+ end
@@ -0,0 +1,48 @@
1
+ module Raysetta
2
+ class Vec2
3
+ attr_accessor x: Float
4
+ attr_accessor y: Float
5
+
6
+ attr_accessor u (): Float
7
+ attr_accessor v (): Float
8
+
9
+ def initialize: (?Float x, ?Float y) -> void
10
+
11
+ def self.random: (?Float min, ?Float max) -> Vec2
12
+ def self.sample_square: () -> instance
13
+
14
+ def []: (Integer i) -> Float
15
+ def []=: (Integer i, Float v) -> void
16
+
17
+ def -@: () -> Vec2
18
+
19
+ def +: (Vec2 v) -> Vec2
20
+ def -: (Vec2 v) -> Vec2
21
+ def *: (Float t) -> Vec2
22
+ def /: (Float t) -> Vec2
23
+
24
+ def add: (Vec2 v) -> self
25
+ def sub: (Vec2 v) -> self
26
+ def mul: (Float t) -> self
27
+ def div: (Float t) -> self
28
+
29
+ def neg: () -> self
30
+
31
+ def length: () -> Float
32
+ def length_squared: () -> Float
33
+
34
+ def dot: (Vec2 v) -> Float
35
+ def unit: () -> Vec2
36
+ def normalize: () -> self
37
+
38
+ def dup: () -> Vec2
39
+
40
+ def abs!: () -> self
41
+ def abs: () -> Vec2
42
+
43
+ def zero?: () -> bool
44
+
45
+ def to_a: () -> [Float, Float]
46
+ alias to_ary to_a
47
+ end
48
+ end
@@ -0,0 +1,67 @@
1
+ module Raysetta
2
+ class Vec3
3
+ attr_accessor x: Float
4
+ attr_accessor y: Float
5
+ attr_accessor z: Float
6
+
7
+ attr_accessor r (): Float
8
+ attr_accessor g (): Float
9
+ attr_accessor b (): Float
10
+
11
+ def self.dimensions: () -> 3
12
+
13
+ def initialize: (?Float x, ?Float y, ?Float z) -> void
14
+
15
+ def self.random: (?Float min, ?Float max) -> Vec3
16
+ def self.random_in_unit_sphere: () -> instance
17
+ def self.random_unit: () -> instance
18
+ def self.random_on_hemisphere: (Vec3 normal) -> instance
19
+ def self.random_in_unit_disk: () -> instance
20
+
21
+ def []: (Integer i) -> Float
22
+ def []=: (Integer i, Float v) -> void
23
+
24
+ def -@: () -> Vec3
25
+
26
+ def +: (Vec3 v) -> Vec3
27
+ def -: (Vec3 v) -> Vec3
28
+ def *: (Float t) -> Vec3
29
+ def /: (Float t) -> Vec3
30
+
31
+ def add: (Vec3 v) -> self
32
+ def sub: (Vec3 v) -> self
33
+ def mul: (Float t) -> self
34
+ def div: (Float t) -> self
35
+
36
+ def neg: () -> self
37
+
38
+ def length: () -> Float
39
+ def length_squared: () -> Float
40
+
41
+ def dot: (Vec3 v) -> Float
42
+ def unit: () -> Vec3
43
+ def normalize: () -> self
44
+
45
+ def dup: () -> Vec3
46
+
47
+ def abs!: () -> self
48
+ def abs: () -> Vec3
49
+
50
+ def smoothstep!: () -> self
51
+ def smoothstep: () -> Vec3
52
+
53
+ def multiply: (Vec3 v) -> self
54
+ def times: (Vec3 v) -> Vec3
55
+
56
+ def cross: (Vec3 v) -> Vec3
57
+ def reflect: (Vec3 n) -> Vec3
58
+ def refract: (Vec3 n, Float etai_over_etat) -> instance
59
+
60
+ def to_pixel: () -> [Integer, Integer, Integer]
61
+
62
+ def zero?: () -> bool
63
+
64
+ def to_a: () -> [Float, Float, Float]
65
+ alias to_ary to_a
66
+ end
67
+ end
data/sig/raysetta.rbs ADDED
@@ -0,0 +1,6 @@
1
+ module Raysetta
2
+ VERSION: String
3
+
4
+ class Error < StandardError
5
+ end
6
+ end
@@ -0,0 +1,24 @@
1
+ module ChunkyPNG
2
+ class Canvas
3
+ def width: () -> Integer
4
+ def height: () -> Integer
5
+ def get_pixel: (Integer, Integer) -> Color
6
+ def set_pixel: (Integer, Integer, Integer) -> void
7
+ def to_data_url: () -> String
8
+ def save: (String, Symbol) -> void
9
+ end
10
+
11
+ class Image < Canvas
12
+ def initialize: (Integer width, Integer height) -> void
13
+
14
+ def self.from_file: (String) -> instance
15
+ def self.from_data_url: (String) -> instance
16
+ end
17
+
18
+ class Color
19
+ def self.r: (instance) -> Integer
20
+ def self.g: (instance) -> Integer
21
+ def self.b: (instance) -> Integer
22
+ def self.rgb: (Integer, Integer, Integer) -> Integer
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module Etc
2
+ def self.nprocessors: () -> Integer
3
+ end
@@ -0,0 +1,3 @@
1
+ module JSON
2
+ def self.parse: (String) -> Hash[String, untyped]
3
+ end
@@ -0,0 +1,4 @@
1
+ class OptionParser
2
+ def initialize: () { (untyped) -> void } -> void
3
+ def parse!: () -> void
4
+ end
@@ -0,0 +1,5 @@
1
+ module Parallel
2
+ def self.map: [I, O] (Array[I], in_threads: Integer, ?finish: Proc) { (I) -> O } -> Array[O]
3
+ | [I, O] (Array[I], in_processes: Integer, ?finish: Proc) { (I) -> O } -> Array[O]
4
+ | [I] (Array[I], in_ractors: Integer, ractor: [Class, Symbol], ?finish: Proc) -> Array[untyped]
5
+ end
@@ -0,0 +1,5 @@
1
+ module Progress
2
+ def self.start: (String, Integer) -> void
3
+ def self.step: () -> void
4
+ def self.stop: () -> void
5
+ end