blankity 0.10.1 → 0.11.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/lib/blankity/blank.rb +3 -1
- data/lib/blankity/to.rb +41 -54
- data/lib/blankity/value.rb +166 -0
- data/lib/blankity/version.rb +1 -1
- data/lib/blankity.rb +1 -1
- data/sig/generated/blankity/blank.rbs +7 -11
- data/sig/generated/blankity/to.rbs +45 -49
- data/sig/generated/blankity/value.rbs +158 -0
- data/sig/generated/blankity.rbs +4 -0
- metadata +3 -3
- data/lib/blankity/classes.rb +0 -300
- data/sig/generated/blankity/classes.rbs +0 -247
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb74367673b591a115da493f40ebc58de31795567e08c7b24e7c97c51da256fc
|
|
4
|
+
data.tar.gz: 8945066e28ec8457e1956ea751c3e0fcc24165c4cca2ac6bce662e66b1221752
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 521bbfc81372ae7f66dcefa14120075b47ad99ed7ad970576f01ed9fcdac07015be9005c755eed357ad54d3fc8332f7287c9f3cc9b76542e1f6a91a8df943c25
|
|
7
|
+
data.tar.gz: 343abcf8d29f2d4e506e0ff9e4fd44b59057b4aec1654a86f2f8ebd6766a38606343a9f9d008bea2648b22b0730d7c245e14b822c3ed9822fa1b003cde68ac73
|
data/lib/blankity/blank.rb
CHANGED
|
@@ -20,8 +20,10 @@ module Blankity
|
|
|
20
20
|
# @rbs!
|
|
21
21
|
# def __define_singleton_method__: (interned name, Method | UnboundMethod | Proc method) -> Symbol
|
|
22
22
|
# | (interned name) { (?) [self: self] -> untyped } -> Symbol
|
|
23
|
-
# def __instance_exec__: [T] (*untyped, **untyped) { (?) [self: self] -> T } -> T
|
|
24
23
|
define_method :__define_singleton_method__, ::Kernel.instance_method(:define_singleton_method)
|
|
24
|
+
|
|
25
|
+
# @rbs!
|
|
26
|
+
# def __instance_exec__: [T] (*untyped, **untyped) { (?) [self: self] -> T } -> T
|
|
25
27
|
alias_method :__instance_exec__, :instance_exec # Use `alias_method` instead of `alias` so rbs-inline won't pick it up
|
|
26
28
|
|
|
27
29
|
# Remove every other public and protected method that we inherit, except for `__xyz__` methods
|
data/lib/blankity/to.rb
CHANGED
|
@@ -4,56 +4,44 @@
|
|
|
4
4
|
module Blankity
|
|
5
5
|
# Convenience methods for creating new +BlankIty::ToXXX+ instances.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
7
|
+
# This module can be +include+/+extend+ed to define the `to` function, which lets you do things
|
|
8
|
+
# like +system to.str('ls -al')+. (The module is not mixin-able, as it overwrites {Kernel} methods,
|
|
9
|
+
# notably +proc+ and +hash+).
|
|
10
10
|
module To
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# Warn when extending +To+
|
|
17
|
-
def self.extended(mod)
|
|
18
|
-
$VERBOSE and warn 'extending Blankity::To overwrites Kernel#proc and Kernel#hash', uplevel: 1
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Warn when prepending +To+
|
|
22
|
-
def self.prepended(mod)
|
|
23
|
-
$VERBOSE and warn 'prepending Blankity::To overwrites Kernel#proc and Kernel#hash', uplevel: 1
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
module_function
|
|
11
|
+
# Helper method so you can `include Blankity::To` and then `to.str(...)`.
|
|
12
|
+
#
|
|
13
|
+
# @rbs () -> singleton(Blankity::To)
|
|
14
|
+
module_function def to = ::Blankity::To
|
|
27
15
|
|
|
28
16
|
# Convenience method to make {ToI}s from +value.to_i+
|
|
29
17
|
#
|
|
30
|
-
# @rbs (_ToI, ?
|
|
31
|
-
def i(value, ...) = ToI.new(value.to_i, ...)
|
|
18
|
+
# @rbs (_ToI, ?with: Array[interned], ?hash: bool) ?{ () [self: ToI] -> void } -> ToI
|
|
19
|
+
def self.i(value, ...) = ToI.new(value.to_i, ...)
|
|
32
20
|
|
|
33
21
|
# Convenience method to make {ToInt}s from +value.to_int+
|
|
34
22
|
#
|
|
35
|
-
# @rbs (int, ?
|
|
36
|
-
def int(value, ...) = ToInt.new(value.to_int, ...)
|
|
23
|
+
# @rbs (int, ?with: Array[interned], ?hash: bool) ?{ () [self: ToInt] -> void } -> ToInt
|
|
24
|
+
def self.int(value, ...) = ToInt.new(value.to_int, ...)
|
|
37
25
|
|
|
38
26
|
# Convenience method to make {ToS}s from +value.to_s+
|
|
39
27
|
#
|
|
40
|
-
# @rbs (_ToS, ?
|
|
41
|
-
def s(value, ...) = ToS.new(value.to_s, ...)
|
|
28
|
+
# @rbs (_ToS, ?with: Array[interned], ?hash: bool) ?{ () [self: ToS] -> void } -> ToS
|
|
29
|
+
def self.s(value, ...) = ToS.new(value.to_s, ...)
|
|
42
30
|
|
|
43
31
|
# Convenience method to make {ToStr}s from +value.to_str+
|
|
44
32
|
#
|
|
45
|
-
# @rbs (string, ?
|
|
46
|
-
def str(value, ...) = ToStr.new(value.to_str, ...)
|
|
33
|
+
# @rbs (string, ?with: Array[interned], ?hash: bool) ?{ () [self: ToStr] -> void } -> ToStr
|
|
34
|
+
def self.str(value, ...) = ToStr.new(value.to_str, ...)
|
|
47
35
|
|
|
48
36
|
# Convenience method to make {ToA}s from +elements+
|
|
49
37
|
#
|
|
50
|
-
# @rbs [T] (*T, ?
|
|
51
|
-
def a(*elements, **, &) = ToA.new(elements, **, &)
|
|
38
|
+
# @rbs [T] (*T, ?with: Array[interned], ?hash: bool) ?{ () [self: ToA[T]] -> void } -> ToA[T]
|
|
39
|
+
def self.a(*elements, **, &) = ToA.new(elements, **, &)
|
|
52
40
|
|
|
53
41
|
# Convenience method to make {ToAry}s from +elements+
|
|
54
42
|
#
|
|
55
|
-
# @rbs [T] (*T, ?
|
|
56
|
-
def ary(*elements, **, &) = ToAry.new(elements, **, &)
|
|
43
|
+
# @rbs [T] (*T, ?with: Array[interned], ?hash: bool) ?{ () [self: ToAry[T]] -> void } -> ToAry[T]
|
|
44
|
+
def self.ary(*elements, **, &) = ToAry.new(elements, **, &)
|
|
57
45
|
|
|
58
46
|
# Convenience method to make {ToH}s from +hash+
|
|
59
47
|
#
|
|
@@ -61,9 +49,9 @@ module Blankity
|
|
|
61
49
|
# shorthand, but you can't then pass keyword arguments to {ToH}'s constructor. To do so, instead
|
|
62
50
|
# pass in a Hash as a positional argument (e.g. +Blankity::To.h({ 'a' => 'b' }, ...)+)
|
|
63
51
|
#
|
|
64
|
-
# @rbs [K, V] (_ToH[K, V], ?
|
|
52
|
+
# @rbs [K, V] (_ToH[K, V], ?with: Array[interned], ?hash: bool) ?{ () [self: ToH[K, V]] -> void } -> ToH[K, V]
|
|
65
53
|
# | [K, V] (**V) ?{ () [self: ToH[K, V]] -> void } -> ToH[K, V]
|
|
66
|
-
def h(hash = nil, **, &)
|
|
54
|
+
def self.h(hash = nil, **, &)
|
|
67
55
|
if hash
|
|
68
56
|
ToH.new(hash.to_h, **, &)
|
|
69
57
|
else
|
|
@@ -77,9 +65,9 @@ module Blankity
|
|
|
77
65
|
# shorthand, but you can't then pass keyword arguments to {ToHash}'s constructor. To do so, instead
|
|
78
66
|
# pass in a Hash as a positional argument (e.g. +Blankity::To.hash({ 'a' => 'b' }, ...)+)
|
|
79
67
|
#
|
|
80
|
-
# @rbs [K, V] (hash[K, V], ?
|
|
68
|
+
# @rbs [K, V] (hash[K, V], ?with: Array[interned], ?hash: bool) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[K, V]
|
|
81
69
|
# | [K, V] (**V) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[K, V]
|
|
82
|
-
def hash(hash = nil, **, &)
|
|
70
|
+
def self.hash(hash = nil, **, &)
|
|
83
71
|
if hash
|
|
84
72
|
ToHash.new(hash.to_hash, **, &)
|
|
85
73
|
else
|
|
@@ -89,39 +77,39 @@ module Blankity
|
|
|
89
77
|
|
|
90
78
|
# Convenience method to make {ToSym}s from +value.to_sym+
|
|
91
79
|
#
|
|
92
|
-
# @rbs (_ToSym, ?
|
|
93
|
-
def sym(value, ...) = ToSym.new(value.to_sym, ...)
|
|
80
|
+
# @rbs (_ToSym, ?with: Array[interned], ?hash: bool) ?{ () [self: ToSym] -> void } -> ToSym
|
|
81
|
+
def self.sym(value, ...) = ToSym.new(value.to_sym, ...)
|
|
94
82
|
|
|
95
83
|
# Convenience method to make {ToR}s from +value.to_r+
|
|
96
84
|
#
|
|
97
|
-
# @rbs (_ToR, ?
|
|
98
|
-
def r(value, ...) = ToR.new(value.to_r, ...)
|
|
85
|
+
# @rbs (_ToR, ?with: Array[interned], ?hash: bool) ?{ () [self: ToR] -> void } -> ToR
|
|
86
|
+
def self.r(value, ...) = ToR.new(value.to_r, ...)
|
|
99
87
|
|
|
100
88
|
# Convenience method to make {ToC}s from +value.to_c+
|
|
101
89
|
#
|
|
102
|
-
# @rbs (_ToC, ?
|
|
103
|
-
def c(value, ...) = ToC.new(value.to_c, ...)
|
|
90
|
+
# @rbs (_ToC, ?with: Array[interned], ?hash: bool) ?{ () [self: ToC] -> void } -> ToC
|
|
91
|
+
def self.c(value, ...) = ToC.new(value.to_c, ...)
|
|
104
92
|
|
|
105
93
|
# Convenience method to make {ToF}s from +value.to_f+
|
|
106
94
|
#
|
|
107
|
-
# @rbs (float, ?
|
|
108
|
-
def f(value, ...) = ToF.new(value.to_f, ...)
|
|
95
|
+
# @rbs (float, ?with: Array[interned], ?hash: bool) ?{ () [self: ToF] -> void } -> ToF
|
|
96
|
+
def self.f(value, ...) = ToF.new(value.to_f, ...)
|
|
109
97
|
|
|
110
98
|
# Convenience method to make {ToRegexp}s from +value.to_regexp+
|
|
111
99
|
#
|
|
112
|
-
# @rbs (Regexp::_ToRegexp | Regexp, ?
|
|
113
|
-
def regexp(value, ...) = ToRegexp.new(Regexp === value ? value : value.to_regexp, ...)
|
|
100
|
+
# @rbs (Regexp::_ToRegexp | Regexp, ?with: Array[interned], ?hash: bool) ?{ () [self: ToRegexp] -> void } -> ToRegexp
|
|
101
|
+
def self.regexp(value, ...) = ToRegexp.new(Regexp === value ? value : value.to_regexp, ...)
|
|
114
102
|
|
|
115
103
|
# Convenience method to make {ToPath}s from +value.to_path+, or +Kernel#String(value)+
|
|
116
104
|
# if +value+ doesn't define +#to_path+.
|
|
117
105
|
#
|
|
118
|
-
# @rbs (path, ?
|
|
119
|
-
def path(value, ...) = ToPath.new(defined?(value.to_path) ? value.to_path : String(value), ...)
|
|
106
|
+
# @rbs (path, ?with: Array[interned], ?hash: bool) ?{ () [self: ToPath] -> void } -> ToPath
|
|
107
|
+
def self.path(value, ...) = ToPath.new(defined?(value.to_path) ? value.to_path : String(value), ...)
|
|
120
108
|
|
|
121
109
|
# Convenience method to make {ToIO}s from +value.to_io+
|
|
122
110
|
#
|
|
123
|
-
# @rbs (io, ?
|
|
124
|
-
def io(value, ...) = ToIO.new(value.to_io, ...)
|
|
111
|
+
# @rbs (io, ?with: Array[interned], ?hash: bool) ?{ () [self: ToIO] -> void } -> ToIO
|
|
112
|
+
def self.io(value, ...) = ToIO.new(value.to_io, ...)
|
|
125
113
|
|
|
126
114
|
# Convenience method to make {ToProc}s from the supplied block, or +proc+ if no block is given.
|
|
127
115
|
#
|
|
@@ -129,8 +117,8 @@ module Blankity
|
|
|
129
117
|
# shorthand, but then you can't pass a block to {ToProc}'s constructor. To so do, instead pass
|
|
130
118
|
# the block as a positional parameter (eg +Blankity::To.proc(proc { ... }) { ... }+)
|
|
131
119
|
#
|
|
132
|
-
# @rbs (_ToProc, ?
|
|
133
|
-
# | (?
|
|
120
|
+
# @rbs (_ToProc, ?with: Array[interned], ?hash: bool) ?{ () [self: ToProc] -> void } -> ToProc
|
|
121
|
+
# | (?with: Array[interned], ?hash: bool) { (?) -> untyped } -> ToProc
|
|
134
122
|
def self.proc(proc = nil, **, &block)
|
|
135
123
|
if proc
|
|
136
124
|
ToProc.new(proc.to_proc, **, &block)
|
|
@@ -143,10 +131,9 @@ module Blankity
|
|
|
143
131
|
|
|
144
132
|
# Convenience method to make {Range}s from the supplied arguments.
|
|
145
133
|
#
|
|
146
|
-
# @rbs [T] (T?, T?, ?bool, ?
|
|
147
|
-
def range(begin_, end_, exclude_end = false, ...)
|
|
134
|
+
# @rbs [T] (T?, T?, ?bool, ?with: Array[interned], ?hash: bool) ?{ () [self: Range[T]] -> void } -> Range[T]
|
|
135
|
+
def self.range(begin_, end_, exclude_end = false, ...)
|
|
148
136
|
__any__ = Range.new(begin_, end_, exclude_end, ...)
|
|
149
137
|
end
|
|
150
138
|
end
|
|
151
139
|
end
|
|
152
|
-
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
module Blankity
|
|
5
|
+
# @rbs generic T
|
|
6
|
+
class Value < Blank
|
|
7
|
+
# The underlying value
|
|
8
|
+
attr_reader :__value__ #: T
|
|
9
|
+
|
|
10
|
+
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
11
|
+
#
|
|
12
|
+
# @rbs (T, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
13
|
+
def initialize(value, ...)
|
|
14
|
+
@__value__ = value
|
|
15
|
+
super(...)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# A Class which only defines +#to_i+; it implements RBS's +_ToI+ interface.
|
|
20
|
+
#
|
|
21
|
+
# @rbs inherits Value[Integer]
|
|
22
|
+
class ToI < Value
|
|
23
|
+
alias to_i __value__
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# A Class which exclusively defines +#to_int+; it implements RBS's +_ToInt+ interface.
|
|
27
|
+
#
|
|
28
|
+
# @rbs inherits Value[Integer]
|
|
29
|
+
class ToInt < Value
|
|
30
|
+
alias to_int __value__
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# A Class which exclusively defines +#to_s+; it implements RBS's +_ToS+ interface.
|
|
34
|
+
#
|
|
35
|
+
# @rbs inherits Value[String]
|
|
36
|
+
class ToS < Value
|
|
37
|
+
alias to_s __value__
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# A Class which exclusively defines +#to_str+; it implements RBS's +_ToStr+ interface.
|
|
41
|
+
#
|
|
42
|
+
# @rbs inherits Value[String]
|
|
43
|
+
class ToStr < Value
|
|
44
|
+
alias to_str __value__
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# A Class which exclusively defines +#to_a+; it implements RBS's +_ToA[T]+ interface.
|
|
48
|
+
#
|
|
49
|
+
# @rbs generic unchecked out T -- Type of elements
|
|
50
|
+
# @rbs inherits Value[Array[T]]
|
|
51
|
+
class ToA < Value
|
|
52
|
+
alias to_a __value__
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# A Class which exclusively defines +#to_ary+; it implements RBS's +_ToAry[T]+ interface.
|
|
56
|
+
#
|
|
57
|
+
# @rbs generic unchecked out T -- Type of elements
|
|
58
|
+
# @rbs inherits Value[Array[T]]
|
|
59
|
+
class ToAry < Value
|
|
60
|
+
alias to_ary __value__
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# A Class which exclusively defines +#to_h+; it implements RBS's +_ToH[K, V]+ interface.
|
|
64
|
+
#
|
|
65
|
+
# @rbs generic unchecked out K -- Type of Key
|
|
66
|
+
# @rbs generic unchecked out V -- Type of Value
|
|
67
|
+
# @rbs inherits Value[Hash[K, V]]
|
|
68
|
+
class ToH < Value
|
|
69
|
+
alias to_h __value__
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# A Class which exclusively defines +#to_hash+; it implements RBS's +_ToHash[K, V]+ interface.
|
|
73
|
+
#
|
|
74
|
+
# @rbs generic unchecked out K -- Type of Key
|
|
75
|
+
# @rbs generic unchecked out V -- Type of Value
|
|
76
|
+
# @rbs inherits Value[Hash[K, V]]
|
|
77
|
+
class ToHash < Value
|
|
78
|
+
alias to_hash __value__
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# A Class which exclusively defines +#to_sym+; it implements RBS's +_ToSym+ interface.
|
|
82
|
+
#
|
|
83
|
+
# @rbs inherits Value[Symbol]
|
|
84
|
+
class ToSym < Value
|
|
85
|
+
alias to_sym __value__
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# A Class which exclusively defines +#to_r+; it implements RBS's +_ToR+ interface.
|
|
89
|
+
#
|
|
90
|
+
# @rbs inherits Value[Rational]
|
|
91
|
+
class ToR < Value
|
|
92
|
+
alias to_r __value__
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# A Class which exclusively defines +#to_c+; it implements RBS's +_ToC+ interface.
|
|
96
|
+
#
|
|
97
|
+
# @rbs inherits Value[Complex]
|
|
98
|
+
class ToC < Value
|
|
99
|
+
alias to_c __value__
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# A Class which exclusively defines +#to_f+; it implements RBS's +_ToF+ interface.
|
|
103
|
+
#
|
|
104
|
+
# @rbs inherits Value[Float]
|
|
105
|
+
class ToF < Value
|
|
106
|
+
alias to_f __value__
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# A Class which exclusively defines +#to_regexp+; it implements RBS's +Regexp::_ToRegexp+ interface.
|
|
110
|
+
#
|
|
111
|
+
# @rbs inherits Value[Regexp]
|
|
112
|
+
class ToRegexp < Value
|
|
113
|
+
alias to_regexp __value__
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# A Class which exclusively defines +#to_path+; it implements RBS's +_ToPath+ interface.
|
|
117
|
+
#
|
|
118
|
+
# @rbs inherits Value[String]
|
|
119
|
+
class ToPath < Value
|
|
120
|
+
alias to_path __value__
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# A Class which exclusively defines +#to_io+; it implements RBS's +_ToIO+ interface.
|
|
124
|
+
#
|
|
125
|
+
# @rbs inherits Value[IO]
|
|
126
|
+
class ToIO < Value
|
|
127
|
+
alias to_io __value__
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# A Class which exclusively defines +#to_proc+; it implements RBS's +_ToProc+ interface.
|
|
131
|
+
#
|
|
132
|
+
# @rbs inherits Value[Proc]
|
|
133
|
+
class ToProc < Value
|
|
134
|
+
alias to_proc __value__
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# A Class which defines `#begin`, `#end`, and `#exclude_end?`. It implements RBS's +_Range[T]+
|
|
138
|
+
# interface.
|
|
139
|
+
#
|
|
140
|
+
# @rbs generic out T -- Type to iterate over
|
|
141
|
+
class Range < Blank
|
|
142
|
+
# @rbs @__begin__: T?
|
|
143
|
+
# @rbs @__end__: T?
|
|
144
|
+
# @rbs @__exclude_end__: bool
|
|
145
|
+
|
|
146
|
+
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
147
|
+
#
|
|
148
|
+
# @rbs (T?, T?, ?bool, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
149
|
+
def initialize(begin_, end_, exclude_end = false, ...)
|
|
150
|
+
@__begin__ = begin_
|
|
151
|
+
@__end__ = end_
|
|
152
|
+
@__exclude_end__ = exclude_end
|
|
153
|
+
|
|
154
|
+
super(...)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# @rbs () -> T?
|
|
158
|
+
def begin = @__begin__
|
|
159
|
+
|
|
160
|
+
# @rbs () -> T?
|
|
161
|
+
def end = @__end__
|
|
162
|
+
|
|
163
|
+
# @rbs () -> bool
|
|
164
|
+
def exclude_end? = @__exclude_end__
|
|
165
|
+
end
|
|
166
|
+
end
|
data/lib/blankity/version.rb
CHANGED
data/lib/blankity.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Blankity
|
|
|
11
11
|
# - Private methods are not undefined, as each one of them is expected to be present (most of them
|
|
12
12
|
# are hooks, eg +singleton_method_added+), and aren't easily accessible from external classes.
|
|
13
13
|
#
|
|
14
|
-
# To make using +Blank+ easier, its constructor allows you to pass a +
|
|
14
|
+
# To make using +Blank+ easier, its constructor allows you to pass a +with:+ keyword argument,
|
|
15
15
|
# which will define singleton methods based on {Object}.
|
|
16
16
|
class Blank < BasicObject
|
|
17
17
|
def __define_singleton_method__: (interned name, Method | UnboundMethod | Proc method) -> Symbol
|
|
@@ -19,12 +19,13 @@ module Blankity
|
|
|
19
19
|
|
|
20
20
|
def __instance_exec__: [T] (*untyped, **untyped) { (?) [self: self] -> T } -> T
|
|
21
21
|
|
|
22
|
+
# Alias for `new`
|
|
22
23
|
alias self.blank self.new
|
|
23
24
|
|
|
24
25
|
# Creates a new {BlankValue}, and defining singleton methods depending on the parameters
|
|
25
26
|
#
|
|
26
|
-
# @param
|
|
27
|
-
# @param hash [bool] convenience argument, adds +hash+ and +eql?+ to +
|
|
27
|
+
# @param with [Array[interned]] a list of {Object} methods to define on +self+.
|
|
28
|
+
# @param hash [bool] convenience argument, adds +hash+ and +eql?+ to +with+ so the resulting
|
|
28
29
|
# type can be used as a key in +Hash+es
|
|
29
30
|
# @yield [] if a block is given, runs it via +__instance_exec__+.
|
|
30
31
|
#
|
|
@@ -33,17 +34,12 @@ module Blankity
|
|
|
33
34
|
# Blankity::Blank.new
|
|
34
35
|
#
|
|
35
36
|
# # Include `Object#inspect`, so we can print with `p`
|
|
36
|
-
# p Blankity::Blank.new(
|
|
37
|
+
# p Blankity::Blank.new(with: %i[inspect])
|
|
37
38
|
#
|
|
38
39
|
# # Define a singleton method
|
|
39
40
|
# p Blankity::Blank.new{ def cool?(other) = other == 3 }.cool?(3) #=> true
|
|
40
41
|
#
|
|
41
|
-
# @rbs (?
|
|
42
|
-
def initialize: (?
|
|
42
|
+
# @rbs (?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
43
|
+
def initialize: (?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
43
44
|
end
|
|
44
|
-
|
|
45
|
-
# Shorthand constructor {Blankity::Blank}.
|
|
46
|
-
#
|
|
47
|
-
# @rbs (?methods: Array[interned], ?hash: bool) ?{ () [self: Blank] -> void } -> Blank
|
|
48
|
-
def self.blank: (?methods: Array[interned], ?hash: bool) ?{ () [self: Blank] -> void } -> Blank
|
|
49
45
|
end
|
|
@@ -3,48 +3,44 @@
|
|
|
3
3
|
module Blankity
|
|
4
4
|
# Convenience methods for creating new +BlankIty::ToXXX+ instances.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
6
|
+
# This module can be +include+/+extend+ed to define the `to` function, which lets you do things
|
|
7
|
+
# like +system to.str('ls -al')+. (The module is not mixin-able, as it overwrites {Kernel} methods,
|
|
8
|
+
# notably +proc+ and +hash+).
|
|
9
9
|
module To
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def self.extended: (untyped mod) -> untyped
|
|
15
|
-
|
|
16
|
-
# Warn when prepending +To+
|
|
17
|
-
def self.prepended: (untyped mod) -> untyped
|
|
10
|
+
# Helper method so you can `include Blankity::To` and then `to.str(...)`.
|
|
11
|
+
#
|
|
12
|
+
# @rbs () -> singleton(Blankity::To)
|
|
13
|
+
def to: () -> singleton(Blankity::To)
|
|
18
14
|
|
|
19
15
|
# Convenience method to make {ToI}s from +value.to_i+
|
|
20
16
|
#
|
|
21
|
-
# @rbs (_ToI, ?
|
|
22
|
-
def self
|
|
17
|
+
# @rbs (_ToI, ?with: Array[interned], ?hash: bool) ?{ () [self: ToI] -> void } -> ToI
|
|
18
|
+
def self.i: (_ToI, ?with: Array[interned], ?hash: bool) ?{ () [self: ToI] -> void } -> ToI
|
|
23
19
|
|
|
24
20
|
# Convenience method to make {ToInt}s from +value.to_int+
|
|
25
21
|
#
|
|
26
|
-
# @rbs (int, ?
|
|
27
|
-
def self
|
|
22
|
+
# @rbs (int, ?with: Array[interned], ?hash: bool) ?{ () [self: ToInt] -> void } -> ToInt
|
|
23
|
+
def self.int: (int, ?with: Array[interned], ?hash: bool) ?{ () [self: ToInt] -> void } -> ToInt
|
|
28
24
|
|
|
29
25
|
# Convenience method to make {ToS}s from +value.to_s+
|
|
30
26
|
#
|
|
31
|
-
# @rbs (_ToS, ?
|
|
32
|
-
def self
|
|
27
|
+
# @rbs (_ToS, ?with: Array[interned], ?hash: bool) ?{ () [self: ToS] -> void } -> ToS
|
|
28
|
+
def self.s: (_ToS, ?with: Array[interned], ?hash: bool) ?{ () [self: ToS] -> void } -> ToS
|
|
33
29
|
|
|
34
30
|
# Convenience method to make {ToStr}s from +value.to_str+
|
|
35
31
|
#
|
|
36
|
-
# @rbs (string, ?
|
|
37
|
-
def self
|
|
32
|
+
# @rbs (string, ?with: Array[interned], ?hash: bool) ?{ () [self: ToStr] -> void } -> ToStr
|
|
33
|
+
def self.str: (string, ?with: Array[interned], ?hash: bool) ?{ () [self: ToStr] -> void } -> ToStr
|
|
38
34
|
|
|
39
35
|
# Convenience method to make {ToA}s from +elements+
|
|
40
36
|
#
|
|
41
|
-
# @rbs [T] (*T, ?
|
|
42
|
-
def self
|
|
37
|
+
# @rbs [T] (*T, ?with: Array[interned], ?hash: bool) ?{ () [self: ToA[T]] -> void } -> ToA[T]
|
|
38
|
+
def self.a: [T] (*T, ?with: Array[interned], ?hash: bool) ?{ () [self: ToA[T]] -> void } -> ToA[T]
|
|
43
39
|
|
|
44
40
|
# Convenience method to make {ToAry}s from +elements+
|
|
45
41
|
#
|
|
46
|
-
# @rbs [T] (*T, ?
|
|
47
|
-
def self
|
|
42
|
+
# @rbs [T] (*T, ?with: Array[interned], ?hash: bool) ?{ () [self: ToAry[T]] -> void } -> ToAry[T]
|
|
43
|
+
def self.ary: [T] (*T, ?with: Array[interned], ?hash: bool) ?{ () [self: ToAry[T]] -> void } -> ToAry[T]
|
|
48
44
|
|
|
49
45
|
# Convenience method to make {ToH}s from +hash+
|
|
50
46
|
#
|
|
@@ -52,10 +48,10 @@ module Blankity
|
|
|
52
48
|
# shorthand, but you can't then pass keyword arguments to {ToH}'s constructor. To do so, instead
|
|
53
49
|
# pass in a Hash as a positional argument (e.g. +Blankity::To.h({ 'a' => 'b' }, ...)+)
|
|
54
50
|
#
|
|
55
|
-
# @rbs [K, V] (_ToH[K, V], ?
|
|
51
|
+
# @rbs [K, V] (_ToH[K, V], ?with: Array[interned], ?hash: bool) ?{ () [self: ToH[K, V]] -> void } -> ToH[K, V]
|
|
56
52
|
# | [K, V] (**V) ?{ () [self: ToH[K, V]] -> void } -> ToH[K, V]
|
|
57
|
-
def self
|
|
58
|
-
|
|
53
|
+
def self.h: [K, V] (_ToH[K, V], ?with: Array[interned], ?hash: bool) ?{ () [self: ToH[K, V]] -> void } -> ToH[K, V]
|
|
54
|
+
| [K, V] (**V) ?{ () [self: ToH[K, V]] -> void } -> ToH[K, V]
|
|
59
55
|
|
|
60
56
|
# Convenience method to make {ToHash}s from +hash+
|
|
61
57
|
#
|
|
@@ -63,46 +59,46 @@ module Blankity
|
|
|
63
59
|
# shorthand, but you can't then pass keyword arguments to {ToHash}'s constructor. To do so, instead
|
|
64
60
|
# pass in a Hash as a positional argument (e.g. +Blankity::To.hash({ 'a' => 'b' }, ...)+)
|
|
65
61
|
#
|
|
66
|
-
# @rbs [K, V] (hash[K, V], ?
|
|
62
|
+
# @rbs [K, V] (hash[K, V], ?with: Array[interned], ?hash: bool) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[K, V]
|
|
67
63
|
# | [K, V] (**V) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[K, V]
|
|
68
|
-
def self
|
|
69
|
-
|
|
64
|
+
def self.hash: [K, V] (hash[K, V], ?with: Array[interned], ?hash: bool) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[K, V]
|
|
65
|
+
| [K, V] (**V) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[K, V]
|
|
70
66
|
|
|
71
67
|
# Convenience method to make {ToSym}s from +value.to_sym+
|
|
72
68
|
#
|
|
73
|
-
# @rbs (_ToSym, ?
|
|
74
|
-
def self
|
|
69
|
+
# @rbs (_ToSym, ?with: Array[interned], ?hash: bool) ?{ () [self: ToSym] -> void } -> ToSym
|
|
70
|
+
def self.sym: (_ToSym, ?with: Array[interned], ?hash: bool) ?{ () [self: ToSym] -> void } -> ToSym
|
|
75
71
|
|
|
76
72
|
# Convenience method to make {ToR}s from +value.to_r+
|
|
77
73
|
#
|
|
78
|
-
# @rbs (_ToR, ?
|
|
79
|
-
def self
|
|
74
|
+
# @rbs (_ToR, ?with: Array[interned], ?hash: bool) ?{ () [self: ToR] -> void } -> ToR
|
|
75
|
+
def self.r: (_ToR, ?with: Array[interned], ?hash: bool) ?{ () [self: ToR] -> void } -> ToR
|
|
80
76
|
|
|
81
77
|
# Convenience method to make {ToC}s from +value.to_c+
|
|
82
78
|
#
|
|
83
|
-
# @rbs (_ToC, ?
|
|
84
|
-
def self
|
|
79
|
+
# @rbs (_ToC, ?with: Array[interned], ?hash: bool) ?{ () [self: ToC] -> void } -> ToC
|
|
80
|
+
def self.c: (_ToC, ?with: Array[interned], ?hash: bool) ?{ () [self: ToC] -> void } -> ToC
|
|
85
81
|
|
|
86
82
|
# Convenience method to make {ToF}s from +value.to_f+
|
|
87
83
|
#
|
|
88
|
-
# @rbs (float, ?
|
|
89
|
-
def self
|
|
84
|
+
# @rbs (float, ?with: Array[interned], ?hash: bool) ?{ () [self: ToF] -> void } -> ToF
|
|
85
|
+
def self.f: (float, ?with: Array[interned], ?hash: bool) ?{ () [self: ToF] -> void } -> ToF
|
|
90
86
|
|
|
91
87
|
# Convenience method to make {ToRegexp}s from +value.to_regexp+
|
|
92
88
|
#
|
|
93
|
-
# @rbs (Regexp::_ToRegexp | Regexp, ?
|
|
94
|
-
def self
|
|
89
|
+
# @rbs (Regexp::_ToRegexp | Regexp, ?with: Array[interned], ?hash: bool) ?{ () [self: ToRegexp] -> void } -> ToRegexp
|
|
90
|
+
def self.regexp: (Regexp::_ToRegexp | Regexp, ?with: Array[interned], ?hash: bool) ?{ () [self: ToRegexp] -> void } -> ToRegexp
|
|
95
91
|
|
|
96
92
|
# Convenience method to make {ToPath}s from +value.to_path+, or +Kernel#String(value)+
|
|
97
93
|
# if +value+ doesn't define +#to_path+.
|
|
98
94
|
#
|
|
99
|
-
# @rbs (path, ?
|
|
100
|
-
def self
|
|
95
|
+
# @rbs (path, ?with: Array[interned], ?hash: bool) ?{ () [self: ToPath] -> void } -> ToPath
|
|
96
|
+
def self.path: (path, ?with: Array[interned], ?hash: bool) ?{ () [self: ToPath] -> void } -> ToPath
|
|
101
97
|
|
|
102
98
|
# Convenience method to make {ToIO}s from +value.to_io+
|
|
103
99
|
#
|
|
104
|
-
# @rbs (io, ?
|
|
105
|
-
def self
|
|
100
|
+
# @rbs (io, ?with: Array[interned], ?hash: bool) ?{ () [self: ToIO] -> void } -> ToIO
|
|
101
|
+
def self.io: (io, ?with: Array[interned], ?hash: bool) ?{ () [self: ToIO] -> void } -> ToIO
|
|
106
102
|
|
|
107
103
|
# Convenience method to make {ToProc}s from the supplied block, or +proc+ if no block is given.
|
|
108
104
|
#
|
|
@@ -110,14 +106,14 @@ module Blankity
|
|
|
110
106
|
# shorthand, but then you can't pass a block to {ToProc}'s constructor. To so do, instead pass
|
|
111
107
|
# the block as a positional parameter (eg +Blankity::To.proc(proc { ... }) { ... }+)
|
|
112
108
|
#
|
|
113
|
-
# @rbs (_ToProc, ?
|
|
114
|
-
# | (?
|
|
115
|
-
def self
|
|
116
|
-
|
|
109
|
+
# @rbs (_ToProc, ?with: Array[interned], ?hash: bool) ?{ () [self: ToProc] -> void } -> ToProc
|
|
110
|
+
# | (?with: Array[interned], ?hash: bool) { (?) -> untyped } -> ToProc
|
|
111
|
+
def self.proc: (_ToProc, ?with: Array[interned], ?hash: bool) ?{ () [self: ToProc] -> void } -> ToProc
|
|
112
|
+
| (?with: Array[interned], ?hash: bool) { (?) -> untyped } -> ToProc
|
|
117
113
|
|
|
118
114
|
# Convenience method to make {Range}s from the supplied arguments.
|
|
119
115
|
#
|
|
120
|
-
# @rbs [T] (T?, T?, ?bool, ?
|
|
121
|
-
def self
|
|
116
|
+
# @rbs [T] (T?, T?, ?bool, ?with: Array[interned], ?hash: bool) ?{ () [self: Range[T]] -> void } -> Range[T]
|
|
117
|
+
def self.range: [T] (T?, T?, ?bool, ?with: Array[interned], ?hash: bool) ?{ () [self: Range[T]] -> void } -> Range[T]
|
|
122
118
|
end
|
|
123
119
|
end
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Generated from lib/blankity/value.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Blankity
|
|
4
|
+
# @rbs generic T
|
|
5
|
+
class Value[T] < Blank
|
|
6
|
+
# The underlying value
|
|
7
|
+
attr_reader __value__: T
|
|
8
|
+
|
|
9
|
+
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
10
|
+
#
|
|
11
|
+
# @rbs (T, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
12
|
+
def initialize: (T, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# A Class which only defines +#to_i+; it implements RBS's +_ToI+ interface.
|
|
16
|
+
#
|
|
17
|
+
# @rbs inherits Value[Integer]
|
|
18
|
+
class ToI < Value[Integer]
|
|
19
|
+
alias to_i __value__
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# A Class which exclusively defines +#to_int+; it implements RBS's +_ToInt+ interface.
|
|
23
|
+
#
|
|
24
|
+
# @rbs inherits Value[Integer]
|
|
25
|
+
class ToInt < Value[Integer]
|
|
26
|
+
alias to_int __value__
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# A Class which exclusively defines +#to_s+; it implements RBS's +_ToS+ interface.
|
|
30
|
+
#
|
|
31
|
+
# @rbs inherits Value[String]
|
|
32
|
+
class ToS < Value[String]
|
|
33
|
+
alias to_s __value__
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# A Class which exclusively defines +#to_str+; it implements RBS's +_ToStr+ interface.
|
|
37
|
+
#
|
|
38
|
+
# @rbs inherits Value[String]
|
|
39
|
+
class ToStr < Value[String]
|
|
40
|
+
alias to_str __value__
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# A Class which exclusively defines +#to_a+; it implements RBS's +_ToA[T]+ interface.
|
|
44
|
+
#
|
|
45
|
+
# @rbs generic unchecked out T -- Type of elements
|
|
46
|
+
# @rbs inherits Value[Array[T]]
|
|
47
|
+
class ToA[unchecked out T] < Value[Array[T]]
|
|
48
|
+
alias to_a __value__
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# A Class which exclusively defines +#to_ary+; it implements RBS's +_ToAry[T]+ interface.
|
|
52
|
+
#
|
|
53
|
+
# @rbs generic unchecked out T -- Type of elements
|
|
54
|
+
# @rbs inherits Value[Array[T]]
|
|
55
|
+
class ToAry[unchecked out T] < Value[Array[T]]
|
|
56
|
+
alias to_ary __value__
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# A Class which exclusively defines +#to_h+; it implements RBS's +_ToH[K, V]+ interface.
|
|
60
|
+
#
|
|
61
|
+
# @rbs generic unchecked out K -- Type of Key
|
|
62
|
+
# @rbs generic unchecked out V -- Type of Value
|
|
63
|
+
# @rbs inherits Value[Hash[K, V]]
|
|
64
|
+
class ToH[unchecked out K, unchecked out V] < Value[Hash[K, V]]
|
|
65
|
+
alias to_h __value__
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# A Class which exclusively defines +#to_hash+; it implements RBS's +_ToHash[K, V]+ interface.
|
|
69
|
+
#
|
|
70
|
+
# @rbs generic unchecked out K -- Type of Key
|
|
71
|
+
# @rbs generic unchecked out V -- Type of Value
|
|
72
|
+
# @rbs inherits Value[Hash[K, V]]
|
|
73
|
+
class ToHash[unchecked out K, unchecked out V] < Value[Hash[K, V]]
|
|
74
|
+
alias to_hash __value__
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# A Class which exclusively defines +#to_sym+; it implements RBS's +_ToSym+ interface.
|
|
78
|
+
#
|
|
79
|
+
# @rbs inherits Value[Symbol]
|
|
80
|
+
class ToSym < Value[Symbol]
|
|
81
|
+
alias to_sym __value__
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# A Class which exclusively defines +#to_r+; it implements RBS's +_ToR+ interface.
|
|
85
|
+
#
|
|
86
|
+
# @rbs inherits Value[Rational]
|
|
87
|
+
class ToR < Value[Rational]
|
|
88
|
+
alias to_r __value__
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# A Class which exclusively defines +#to_c+; it implements RBS's +_ToC+ interface.
|
|
92
|
+
#
|
|
93
|
+
# @rbs inherits Value[Complex]
|
|
94
|
+
class ToC < Value[Complex]
|
|
95
|
+
alias to_c __value__
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# A Class which exclusively defines +#to_f+; it implements RBS's +_ToF+ interface.
|
|
99
|
+
#
|
|
100
|
+
# @rbs inherits Value[Float]
|
|
101
|
+
class ToF < Value[Float]
|
|
102
|
+
alias to_f __value__
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# A Class which exclusively defines +#to_regexp+; it implements RBS's +Regexp::_ToRegexp+ interface.
|
|
106
|
+
#
|
|
107
|
+
# @rbs inherits Value[Regexp]
|
|
108
|
+
class ToRegexp < Value[Regexp]
|
|
109
|
+
alias to_regexp __value__
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# A Class which exclusively defines +#to_path+; it implements RBS's +_ToPath+ interface.
|
|
113
|
+
#
|
|
114
|
+
# @rbs inherits Value[String]
|
|
115
|
+
class ToPath < Value[String]
|
|
116
|
+
alias to_path __value__
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# A Class which exclusively defines +#to_io+; it implements RBS's +_ToIO+ interface.
|
|
120
|
+
#
|
|
121
|
+
# @rbs inherits Value[IO]
|
|
122
|
+
class ToIO < Value[IO]
|
|
123
|
+
alias to_io __value__
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# A Class which exclusively defines +#to_proc+; it implements RBS's +_ToProc+ interface.
|
|
127
|
+
#
|
|
128
|
+
# @rbs inherits Value[Proc]
|
|
129
|
+
class ToProc < Value[Proc]
|
|
130
|
+
alias to_proc __value__
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# A Class which defines `#begin`, `#end`, and `#exclude_end?`. It implements RBS's +_Range[T]+
|
|
134
|
+
# interface.
|
|
135
|
+
#
|
|
136
|
+
# @rbs generic out T -- Type to iterate over
|
|
137
|
+
class Range[out T] < Blank
|
|
138
|
+
@__begin__: T?
|
|
139
|
+
|
|
140
|
+
@__end__: T?
|
|
141
|
+
|
|
142
|
+
@__exclude_end__: bool
|
|
143
|
+
|
|
144
|
+
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
145
|
+
#
|
|
146
|
+
# @rbs (T?, T?, ?bool, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
147
|
+
def initialize: (T?, T?, ?bool, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
148
|
+
|
|
149
|
+
# @rbs () -> T?
|
|
150
|
+
def begin: () -> T?
|
|
151
|
+
|
|
152
|
+
# @rbs () -> T?
|
|
153
|
+
def end: () -> T?
|
|
154
|
+
|
|
155
|
+
# @rbs () -> bool
|
|
156
|
+
def exclude_end?: () -> bool
|
|
157
|
+
end
|
|
158
|
+
end
|
data/sig/generated/blankity.rbs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# Generated from lib/blankity.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
module Blankity
|
|
4
|
+
# Shorthand constructor {Blankity::Blank}.
|
|
5
|
+
#
|
|
6
|
+
# @rbs (?with: Array[interned], ?hash: bool) ?{ () [self: Blank] -> void } -> Blank
|
|
7
|
+
def self.blank: (?with: Array[interned], ?hash: bool) ?{ () [self: Blank] -> void } -> Blank
|
|
4
8
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blankity
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sam Westerman
|
|
@@ -24,15 +24,15 @@ files:
|
|
|
24
24
|
- Steepfile
|
|
25
25
|
- lib/blankity.rb
|
|
26
26
|
- lib/blankity/blank.rb
|
|
27
|
-
- lib/blankity/classes.rb
|
|
28
27
|
- lib/blankity/to.rb
|
|
29
28
|
- lib/blankity/top.rb
|
|
29
|
+
- lib/blankity/value.rb
|
|
30
30
|
- lib/blankity/version.rb
|
|
31
31
|
- sig/generated/blankity.rbs
|
|
32
32
|
- sig/generated/blankity/blank.rbs
|
|
33
|
-
- sig/generated/blankity/classes.rbs
|
|
34
33
|
- sig/generated/blankity/to.rbs
|
|
35
34
|
- sig/generated/blankity/top.rbs
|
|
35
|
+
- sig/generated/blankity/value.rbs
|
|
36
36
|
- sig/generated/blankity/version.rbs
|
|
37
37
|
- sig/test/test/test_blank.rbs
|
|
38
38
|
- sig/test/test/test_helper.rbs
|
data/lib/blankity/classes.rb
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# rbs_inline: enabled
|
|
3
|
-
|
|
4
|
-
module Blankity
|
|
5
|
-
# A Class which only defines +#to_i+; it implements RBS's +_ToI+ interface.
|
|
6
|
-
class ToI < Blank
|
|
7
|
-
# @rbs @__value__: Integer
|
|
8
|
-
|
|
9
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
10
|
-
#
|
|
11
|
-
# @rbs (Integer, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
12
|
-
def initialize(value, ...)
|
|
13
|
-
@__value__ = value
|
|
14
|
-
super(...)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
#: () -> Integer
|
|
18
|
-
def to_i = @__value__
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# A Class which exclusively defines +#to_int+; it implements RBS's +_ToInt+ interface.
|
|
22
|
-
class ToInt < Blank
|
|
23
|
-
# @rbs @__value__: Integer
|
|
24
|
-
|
|
25
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
26
|
-
#
|
|
27
|
-
# @rbs (Integer, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
28
|
-
def initialize(value, ...)
|
|
29
|
-
@__value__ = value
|
|
30
|
-
super(...)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
#: () -> Integer
|
|
34
|
-
def to_int = @__value__
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# A Class which exclusively defines +#to_s+; it implements RBS's +_ToS+ interface.
|
|
38
|
-
class ToS < Blank
|
|
39
|
-
# @rbs @__value__: String
|
|
40
|
-
|
|
41
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
42
|
-
#
|
|
43
|
-
# @rbs (String, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
44
|
-
def initialize(value, ...)
|
|
45
|
-
@__value__ = value
|
|
46
|
-
super(...)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
#: () -> String
|
|
50
|
-
def to_s = @__value__
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# A Class which exclusively defines +#to_str+; it implements RBS's +_ToStr+ interface.
|
|
54
|
-
class ToStr < Blank
|
|
55
|
-
# @rbs @__value__: String
|
|
56
|
-
|
|
57
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
58
|
-
#
|
|
59
|
-
# @rbs (String, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
60
|
-
def initialize(value, ...)
|
|
61
|
-
@__value__ = value
|
|
62
|
-
super(...)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
#: () -> String
|
|
66
|
-
def to_str = @__value__
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# A Class which exclusively defines +#to_a+; it implements RBS's +_ToA[T]+ interface.
|
|
70
|
-
#
|
|
71
|
-
# @rbs generic unchecked out T -- Type of elements
|
|
72
|
-
class ToA < Blank
|
|
73
|
-
# @rbs @__value__: Array[T]
|
|
74
|
-
|
|
75
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
76
|
-
#
|
|
77
|
-
# @rbs (Array[T], ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
78
|
-
def initialize(value, ...)
|
|
79
|
-
@__value__ = value
|
|
80
|
-
super(...)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
#: () -> Array[T]
|
|
84
|
-
def to_a = @__value__
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
# A Class which exclusively defines +#to_ary+; it implements RBS's +_ToAry[T]+ interface.
|
|
88
|
-
#
|
|
89
|
-
# @rbs generic unchecked out T -- Type of elements
|
|
90
|
-
class ToAry < Blank
|
|
91
|
-
# @rbs @__value__: Array[T]
|
|
92
|
-
|
|
93
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
94
|
-
#
|
|
95
|
-
# @rbs (Array[T], ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
96
|
-
def initialize(value, ...)
|
|
97
|
-
@__value__ = value
|
|
98
|
-
super(...)
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
#: () -> Array[T]
|
|
102
|
-
def to_ary = @__value__
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
# A Class which exclusively defines +#to_h+; it implements RBS's +_ToH[K, V]+ interface.
|
|
106
|
-
#
|
|
107
|
-
# @rbs generic unchecked out K -- Type of Key
|
|
108
|
-
# @rbs generic unchecked out V -- Type of Value
|
|
109
|
-
class ToH < Blank
|
|
110
|
-
# @rbs @__value__: Hash[K, V]
|
|
111
|
-
|
|
112
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
113
|
-
#
|
|
114
|
-
# @rbs (Hash[K, V], ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
115
|
-
def initialize(value, ...)
|
|
116
|
-
@__value__ = value
|
|
117
|
-
super(...)
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
#: () -> Hash[K, V]
|
|
121
|
-
def to_h = @__value__
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
# A Class which exclusively defines +#to_hash+; it implements RBS's +_ToHash[K, V]+ interface.
|
|
125
|
-
#
|
|
126
|
-
# @rbs generic unchecked out K -- Type of Key
|
|
127
|
-
# @rbs generic unchecked out V -- Type of Value
|
|
128
|
-
class ToHash < Blank
|
|
129
|
-
# @rbs @__value__: Hash[K, V]
|
|
130
|
-
|
|
131
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
132
|
-
#
|
|
133
|
-
# @rbs (Hash[K, V], ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
134
|
-
def initialize(value, ...)
|
|
135
|
-
@__value__ = value
|
|
136
|
-
super(...)
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
#: () -> Hash[K, V]
|
|
140
|
-
def to_hash = @__value__
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
# A Class which exclusively defines +#to_sym+; it implements RBS's +_ToSym+ interface.
|
|
144
|
-
class ToSym < Blank
|
|
145
|
-
# @rbs @__value__: Symbol
|
|
146
|
-
|
|
147
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
148
|
-
#
|
|
149
|
-
# @rbs (Symbol, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
150
|
-
def initialize(value, ...)
|
|
151
|
-
@__value__ = value
|
|
152
|
-
super(...)
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
#: () -> Symbol
|
|
156
|
-
def to_sym = @__value__
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
# A Class which exclusively defines +#to_r+; it implements RBS's +_ToR+ interface.
|
|
160
|
-
class ToR < Blank
|
|
161
|
-
# @rbs @__value__: Rational
|
|
162
|
-
|
|
163
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
164
|
-
#
|
|
165
|
-
# @rbs (Rational, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
166
|
-
def initialize(value, ...)
|
|
167
|
-
@__value__ = value
|
|
168
|
-
super(...)
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
#: () -> Rational
|
|
172
|
-
def to_r = @__value__
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
# A Class which exclusively defines +#to_c+; it implements RBS's +_ToC+ interface.
|
|
176
|
-
class ToC < Blank
|
|
177
|
-
# @rbs @__value__: Complex
|
|
178
|
-
|
|
179
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
180
|
-
#
|
|
181
|
-
# @rbs (Complex, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
182
|
-
def initialize(value, ...)
|
|
183
|
-
@__value__ = value
|
|
184
|
-
super(...)
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
#: () -> Complex
|
|
188
|
-
def to_c = @__value__
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
# A Class which exclusively defines +#to_f+; it implements RBS's +_ToF+ interface.
|
|
192
|
-
class ToF < Blank
|
|
193
|
-
# @rbs @__value__: Float
|
|
194
|
-
|
|
195
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
196
|
-
#
|
|
197
|
-
# @rbs (Float, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
198
|
-
def initialize(value, ...)
|
|
199
|
-
@__value__ = value
|
|
200
|
-
super(...)
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
#: () -> Float
|
|
204
|
-
def to_f = @__value__
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
# A Class which exclusively defines +#to_regexp+; it implements RBS's +Regexp::_ToRegexp+ interface.
|
|
208
|
-
class ToRegexp < Blank
|
|
209
|
-
# @rbs @__value__: Regexp
|
|
210
|
-
|
|
211
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
212
|
-
#
|
|
213
|
-
# @rbs (Regexp, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
214
|
-
def initialize(value, ...)
|
|
215
|
-
@__value__ = value
|
|
216
|
-
super(...)
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
#: () -> Regexp
|
|
220
|
-
def to_regexp = @__value__
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
# A Class which exclusively defines +#to_path+; it implements RBS's +_ToPath+ interface.
|
|
224
|
-
class ToPath < Blank
|
|
225
|
-
# @rbs @__value__: String
|
|
226
|
-
|
|
227
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
228
|
-
#
|
|
229
|
-
# @rbs (String, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
230
|
-
def initialize(value, ...)
|
|
231
|
-
@__value__ = value
|
|
232
|
-
super(...)
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
#: () -> String
|
|
236
|
-
def to_path = @__value__
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
# A Class which exclusively defines +#to_io+; it implements RBS's +_ToIO+ interface.
|
|
240
|
-
class ToIO < Blank
|
|
241
|
-
# @rbs @__value__: IO
|
|
242
|
-
|
|
243
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
244
|
-
#
|
|
245
|
-
# @rbs (IO, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
246
|
-
def initialize(value, ...)
|
|
247
|
-
@__value__ = value
|
|
248
|
-
super(...)
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
#: () -> IO
|
|
252
|
-
def to_io = @__value__
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
# A Class which exclusively defines +#to_proc+; it implements RBS's +_ToProc+ interface.
|
|
256
|
-
class ToProc < Blank
|
|
257
|
-
# @rbs @__value__: Proc
|
|
258
|
-
|
|
259
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
260
|
-
#
|
|
261
|
-
# @rbs (Proc, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
262
|
-
def initialize(value, ...)
|
|
263
|
-
@__value__ = value
|
|
264
|
-
super(...)
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
#: () -> Proc
|
|
268
|
-
def to_proc = @__value__
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
# A Class which defines `#begin`, `#end`, and `#exclude_end?`. It implements RBS's +_Range[T]+
|
|
272
|
-
# interface.
|
|
273
|
-
#
|
|
274
|
-
# @rbs generic out T -- Type to iterate over
|
|
275
|
-
class Range < Blank
|
|
276
|
-
# @rbs @begin: T?
|
|
277
|
-
# @rbs @end: T?
|
|
278
|
-
# @rbs @exclude_end: bool
|
|
279
|
-
|
|
280
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
281
|
-
#
|
|
282
|
-
# @rbs (T?, T?, ?bool, ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
283
|
-
def initialize(begin_, end_, exclude_end = false, ...)
|
|
284
|
-
@__begin__ = begin_
|
|
285
|
-
@__end__ = end_
|
|
286
|
-
@__exclude_end__ = exclude_end
|
|
287
|
-
|
|
288
|
-
super(...)
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
#: () -> T?
|
|
292
|
-
def begin = @__begin__
|
|
293
|
-
|
|
294
|
-
#: () -> T?
|
|
295
|
-
def end = @__end__
|
|
296
|
-
|
|
297
|
-
#: () -> bool
|
|
298
|
-
def exclude_end? = @__exclude_end__
|
|
299
|
-
end
|
|
300
|
-
end
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
# Generated from lib/blankity/classes.rb with RBS::Inline
|
|
2
|
-
|
|
3
|
-
module Blankity
|
|
4
|
-
# A Class which only defines +#to_i+; it implements RBS's +_ToI+ interface.
|
|
5
|
-
class ToI < Blank
|
|
6
|
-
@__value__: Integer
|
|
7
|
-
|
|
8
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
9
|
-
#
|
|
10
|
-
# @rbs (Integer, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
11
|
-
def initialize: (Integer, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
12
|
-
|
|
13
|
-
# : () -> Integer
|
|
14
|
-
def to_i: () -> Integer
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# A Class which exclusively defines +#to_int+; it implements RBS's +_ToInt+ interface.
|
|
18
|
-
class ToInt < Blank
|
|
19
|
-
@__value__: Integer
|
|
20
|
-
|
|
21
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
22
|
-
#
|
|
23
|
-
# @rbs (Integer, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
24
|
-
def initialize: (Integer, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
25
|
-
|
|
26
|
-
# : () -> Integer
|
|
27
|
-
def to_int: () -> Integer
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# A Class which exclusively defines +#to_s+; it implements RBS's +_ToS+ interface.
|
|
31
|
-
class ToS < Blank
|
|
32
|
-
@__value__: String
|
|
33
|
-
|
|
34
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
35
|
-
#
|
|
36
|
-
# @rbs (String, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
37
|
-
def initialize: (String, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
38
|
-
|
|
39
|
-
# : () -> String
|
|
40
|
-
def to_s: () -> String
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# A Class which exclusively defines +#to_str+; it implements RBS's +_ToStr+ interface.
|
|
44
|
-
class ToStr < Blank
|
|
45
|
-
@__value__: String
|
|
46
|
-
|
|
47
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
48
|
-
#
|
|
49
|
-
# @rbs (String, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
50
|
-
def initialize: (String, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
51
|
-
|
|
52
|
-
# : () -> String
|
|
53
|
-
def to_str: () -> String
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# A Class which exclusively defines +#to_a+; it implements RBS's +_ToA[T]+ interface.
|
|
57
|
-
#
|
|
58
|
-
# @rbs generic unchecked out T -- Type of elements
|
|
59
|
-
class ToA[unchecked out T] < Blank
|
|
60
|
-
@__value__: Array[T]
|
|
61
|
-
|
|
62
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
63
|
-
#
|
|
64
|
-
# @rbs (Array[T], ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
65
|
-
def initialize: (Array[T], ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
66
|
-
|
|
67
|
-
# : () -> Array[T]
|
|
68
|
-
def to_a: () -> Array[T]
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# A Class which exclusively defines +#to_ary+; it implements RBS's +_ToAry[T]+ interface.
|
|
72
|
-
#
|
|
73
|
-
# @rbs generic unchecked out T -- Type of elements
|
|
74
|
-
class ToAry[unchecked out T] < Blank
|
|
75
|
-
@__value__: Array[T]
|
|
76
|
-
|
|
77
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
78
|
-
#
|
|
79
|
-
# @rbs (Array[T], ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
80
|
-
def initialize: (Array[T], ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
81
|
-
|
|
82
|
-
# : () -> Array[T]
|
|
83
|
-
def to_ary: () -> Array[T]
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# A Class which exclusively defines +#to_h+; it implements RBS's +_ToH[K, V]+ interface.
|
|
87
|
-
#
|
|
88
|
-
# @rbs generic unchecked out K -- Type of Key
|
|
89
|
-
# @rbs generic unchecked out V -- Type of Value
|
|
90
|
-
class ToH[unchecked out K, unchecked out V] < Blank
|
|
91
|
-
@__value__: Hash[K, V]
|
|
92
|
-
|
|
93
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
94
|
-
#
|
|
95
|
-
# @rbs (Hash[K, V], ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
96
|
-
def initialize: (Hash[K, V], ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
97
|
-
|
|
98
|
-
# : () -> Hash[K, V]
|
|
99
|
-
def to_h: () -> Hash[K, V]
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
# A Class which exclusively defines +#to_hash+; it implements RBS's +_ToHash[K, V]+ interface.
|
|
103
|
-
#
|
|
104
|
-
# @rbs generic unchecked out K -- Type of Key
|
|
105
|
-
# @rbs generic unchecked out V -- Type of Value
|
|
106
|
-
class ToHash[unchecked out K, unchecked out V] < Blank
|
|
107
|
-
@__value__: Hash[K, V]
|
|
108
|
-
|
|
109
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
110
|
-
#
|
|
111
|
-
# @rbs (Hash[K, V], ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
112
|
-
def initialize: (Hash[K, V], ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
113
|
-
|
|
114
|
-
# : () -> Hash[K, V]
|
|
115
|
-
def to_hash: () -> Hash[K, V]
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
# A Class which exclusively defines +#to_sym+; it implements RBS's +_ToSym+ interface.
|
|
119
|
-
class ToSym < Blank
|
|
120
|
-
@__value__: Symbol
|
|
121
|
-
|
|
122
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
123
|
-
#
|
|
124
|
-
# @rbs (Symbol, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
125
|
-
def initialize: (Symbol, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
126
|
-
|
|
127
|
-
# : () -> Symbol
|
|
128
|
-
def to_sym: () -> Symbol
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# A Class which exclusively defines +#to_r+; it implements RBS's +_ToR+ interface.
|
|
132
|
-
class ToR < Blank
|
|
133
|
-
@__value__: Rational
|
|
134
|
-
|
|
135
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
136
|
-
#
|
|
137
|
-
# @rbs (Rational, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
138
|
-
def initialize: (Rational, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
139
|
-
|
|
140
|
-
# : () -> Rational
|
|
141
|
-
def to_r: () -> Rational
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
# A Class which exclusively defines +#to_c+; it implements RBS's +_ToC+ interface.
|
|
145
|
-
class ToC < Blank
|
|
146
|
-
@__value__: Complex
|
|
147
|
-
|
|
148
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
149
|
-
#
|
|
150
|
-
# @rbs (Complex, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
151
|
-
def initialize: (Complex, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
152
|
-
|
|
153
|
-
# : () -> Complex
|
|
154
|
-
def to_c: () -> Complex
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
# A Class which exclusively defines +#to_f+; it implements RBS's +_ToF+ interface.
|
|
158
|
-
class ToF < Blank
|
|
159
|
-
@__value__: Float
|
|
160
|
-
|
|
161
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
162
|
-
#
|
|
163
|
-
# @rbs (Float, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
164
|
-
def initialize: (Float, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
165
|
-
|
|
166
|
-
# : () -> Float
|
|
167
|
-
def to_f: () -> Float
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
# A Class which exclusively defines +#to_regexp+; it implements RBS's +Regexp::_ToRegexp+ interface.
|
|
171
|
-
class ToRegexp < Blank
|
|
172
|
-
@__value__: Regexp
|
|
173
|
-
|
|
174
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
175
|
-
#
|
|
176
|
-
# @rbs (Regexp, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
177
|
-
def initialize: (Regexp, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
178
|
-
|
|
179
|
-
# : () -> Regexp
|
|
180
|
-
def to_regexp: () -> Regexp
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
# A Class which exclusively defines +#to_path+; it implements RBS's +_ToPath+ interface.
|
|
184
|
-
class ToPath < Blank
|
|
185
|
-
@__value__: String
|
|
186
|
-
|
|
187
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
188
|
-
#
|
|
189
|
-
# @rbs (String, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
190
|
-
def initialize: (String, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
191
|
-
|
|
192
|
-
# : () -> String
|
|
193
|
-
def to_path: () -> String
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
# A Class which exclusively defines +#to_io+; it implements RBS's +_ToIO+ interface.
|
|
197
|
-
class ToIO < Blank
|
|
198
|
-
@__value__: IO
|
|
199
|
-
|
|
200
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
201
|
-
#
|
|
202
|
-
# @rbs (IO, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
203
|
-
def initialize: (IO, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
204
|
-
|
|
205
|
-
# : () -> IO
|
|
206
|
-
def to_io: () -> IO
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
# A Class which exclusively defines +#to_proc+; it implements RBS's +_ToProc+ interface.
|
|
210
|
-
class ToProc < Blank
|
|
211
|
-
@__value__: Proc
|
|
212
|
-
|
|
213
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
214
|
-
#
|
|
215
|
-
# @rbs (Proc, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
216
|
-
def initialize: (Proc, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
217
|
-
|
|
218
|
-
# : () -> Proc
|
|
219
|
-
def to_proc: () -> Proc
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
# A Class which defines `#begin`, `#end`, and `#exclude_end?`. It implements RBS's +_Range[T]+
|
|
223
|
-
# interface.
|
|
224
|
-
#
|
|
225
|
-
# @rbs generic out T -- Type to iterate over
|
|
226
|
-
class Range[out T] < Blank
|
|
227
|
-
@begin: T?
|
|
228
|
-
|
|
229
|
-
@end: T?
|
|
230
|
-
|
|
231
|
-
@exclude_end: bool
|
|
232
|
-
|
|
233
|
-
# Creates a new instance; any additional arguments or block are passed to {Blank#initialize}.
|
|
234
|
-
#
|
|
235
|
-
# @rbs (T?, T?, ?bool, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
236
|
-
def initialize: (T?, T?, ?bool, ?methods: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
|
|
237
|
-
|
|
238
|
-
# : () -> T?
|
|
239
|
-
def begin: () -> T?
|
|
240
|
-
|
|
241
|
-
# : () -> T?
|
|
242
|
-
def end: () -> T?
|
|
243
|
-
|
|
244
|
-
# : () -> bool
|
|
245
|
-
def exclude_end?: () -> bool
|
|
246
|
-
end
|
|
247
|
-
end
|