blankity 0.10.1 → 1.0.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.
@@ -3,48 +3,44 @@
3
3
  module Blankity
4
4
  # Convenience methods for creating new +BlankIty::ToXXX+ instances.
5
5
  #
6
- # Using +To+ as a mixin (via +extend+ / +include+ / +prepend+) isn't suggested, as {Kernel#proc}
7
- # and {Kernel#hash} will be overwritten. Attempting to do so will emit a warning if `$VERBOSE` is
8
- # enabled.
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
- # Warn when including +To+
11
- def self.included: (untyped mod) -> untyped
12
-
13
- # Warn when extending +To+
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToI] -> void } -> ToI
22
- def self?.i: (_ToI, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToI] -> void } -> ToI
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToInt] -> void } -> ToInt
27
- def self?.int: (int, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToInt] -> void } -> ToInt
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToS] -> void } -> ToS
32
- def self?.s: (_ToS, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToS] -> void } -> ToS
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToStr] -> void } -> ToStr
37
- def self?.str: (string, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToStr] -> void } -> ToStr
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToA[T]] -> void } -> ToA[T]
42
- def self?.a: [T] (*T, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToA[T]] -> void } -> ToA[T]
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToAry[T]] -> void } -> ToAry[T]
47
- def self?.ary: [T] (*T, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToAry[T]] -> void } -> ToAry[T]
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], ?methods: Array[interned], ?hash: bool) ?{ () [self: ToH[K, V]] -> void } -> 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?.h: [K, V] (_ToH[K, V], ?methods: Array[interned], ?hash: bool) ?{ () [self: ToH[K, V]] -> void } -> ToH[K, V]
58
- | [K, V] (**V) ?{ () [self: ToH[K, V]] -> void } -> ToH[K, V]
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], ?methods: Array[interned], ?hash: bool) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[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?.hash: [K, V] (hash[K, V], ?methods: Array[interned], ?hash: bool) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[K, V]
69
- | [K, V] (**V) ?{ () [self: ToHash[K, V]] -> void } -> ToHash[K, V]
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToSym] -> void } -> ToSym
74
- def self?.sym: (_ToSym, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToSym] -> void } -> ToSym
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToR] -> void } -> ToR
79
- def self?.r: (_ToR, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToR] -> void } -> ToR
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToC] -> void } -> ToC
84
- def self?.c: (_ToC, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToC] -> void } -> ToC
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToF] -> void } -> ToF
89
- def self?.f: (float, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToF] -> void } -> ToF
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToRegexp] -> void } -> ToRegexp
94
- def self?.regexp: (Regexp::_ToRegexp | Regexp, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToRegexp] -> void } -> ToRegexp
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToPath] -> void } -> ToPath
100
- def self?.path: (path, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToPath] -> void } -> ToPath
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToIO] -> void } -> ToIO
105
- def self?.io: (io, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToIO] -> void } -> ToIO
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToProc] -> void } -> ToProc
114
- # | (?methods: Array[interned], ?hash: bool) { (?) -> untyped } -> ToProc
115
- def self?.proc: (_ToProc, ?methods: Array[interned], ?hash: bool) ?{ () [self: ToProc] -> void } -> ToProc
116
- | (?methods: Array[interned], ?hash: bool) { (?) -> untyped } -> ToProc
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, ?methods: Array[interned], ?hash: bool) ?{ () [self: Range[T]] -> void } -> Range[T]
121
- def self?.range: [T] (T?, T?, ?bool, ?methods: Array[interned], ?hash: bool) ?{ () [self: Range[T]] -> void } -> Range[T]
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
@@ -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.10.1
4
+ version: 1.0.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
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubygems_version: 3.7.0.dev
59
+ rubygems_version: 4.0.3
60
60
  specification_version: 4
61
61
  summary: Provides "blank" objects which only supply conversion methods
62
62
  test_files: []
@@ -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