Skip to content

Commit 5528e59

Browse files
chore: more accurate type annotations and aliases
1 parent 6d43598 commit 5528e59

File tree

6 files changed

+44
-47
lines changed

6 files changed

+44
-47
lines changed

lib/orb/errors.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
module Orb
44
module Errors
55
class Error < StandardError
6-
# @!parse
7-
# # @return [StandardError, nil]
8-
# attr_accessor :cause
6+
# @!attribute cause
7+
#
8+
# @return [StandardError, nil]
99
end
1010

1111
class ConversionError < Orb::Errors::Error
@@ -40,13 +40,13 @@ def initialize(url:, status: nil, body: nil, request: nil, response: nil, messag
4040
end
4141

4242
class APIConnectionError < Orb::Errors::APIError
43-
# @!parse
44-
# # @return [nil]
45-
# attr_accessor :status
43+
# @!attribute status
44+
#
45+
# @return [nil]
4646

47-
# @!parse
48-
# # @return [nil]
49-
# attr_accessor :body
47+
# @!attribute body
48+
#
49+
# @return [nil]
5050

5151
# @api private
5252
#

lib/orb/internal/type/boolean.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@ def coerce(value, state:)
4646
value
4747
end
4848

49-
# @!parse
50-
# # @api private
51-
# #
52-
# # @param value [Boolean, Object]
53-
# #
54-
# # @param state [Hash{Symbol=>Object}] .
55-
# #
56-
# # @option state [Boolean] :can_retry
57-
# #
58-
# # @return [Boolean, Object]
59-
# def dump(value, state:) = super
49+
# @!method dump(value, state:)
50+
# @api private
51+
#
52+
# @param value [Boolean, Object]
53+
#
54+
# @param state [Hash{Symbol=>Object}] .
55+
#
56+
# @option state [Boolean] :can_retry
57+
#
58+
# @return [Boolean, Object]
6059
end
6160
end
6261
end

lib/orb/internal/type/enum.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,16 @@ def coerce(value, state:)
9696
end
9797
end
9898

99-
# @!parse
100-
# # @api private
101-
# #
102-
# # @param value [Symbol, Object]
103-
# #
104-
# # @param state [Hash{Symbol=>Object}] .
105-
# #
106-
# # @option state [Boolean] :can_retry
107-
# #
108-
# # @return [Symbol, Object]
109-
# def dump(value, state:) = super
99+
# @!method dump(value, state:)
100+
# @api private
101+
#
102+
# @param value [Symbol, Object]
103+
#
104+
# @param state [Hash{Symbol=>Object}] .
105+
#
106+
# @option state [Boolean] :can_retry
107+
#
108+
# @return [Symbol, Object]
110109

111110
# @api private
112111
#

lib/orb/internal/type/unknown.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,16 @@ def coerce(value, state:)
4848
value
4949
end
5050

51-
# @!parse
52-
# # @api private
53-
# #
54-
# # @param value [Object]
55-
# #
56-
# # @param state [Hash{Symbol=>Object}] .
57-
# #
58-
# # @option state [Boolean] :can_retry
59-
# #
60-
# # @return [Object]
61-
# def dump(value, state:) = super
51+
# @!method dump(value, state:)
52+
# @api private
53+
#
54+
# @param value [Object]
55+
#
56+
# @param state [Hash{Symbol=>Object}] .
57+
#
58+
# @option state [Boolean] :can_retry
59+
#
60+
# @return [Object]
6261
end
6362

6463
# rubocop:enable Lint/UnusedMethodArgument

lib/orb/request_options.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ def self.validate!(opts)
6565
# @return [Float, nil]
6666
optional :timeout, Float
6767

68-
# @!parse
69-
# # @!method initialize(values = {})
70-
# # Returns a new instance of RequestOptions.
71-
# #
72-
# # @param values [Hash{Symbol=>Object}]
68+
# @!method initialize(values = {})
69+
# Returns a new instance of RequestOptions.
70+
#
71+
# @param values [Hash{Symbol=>Object}]
7372
end
7473
end

test/orb/file_part_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ def test_to_json
88
filepart = Orb::FilePart.new(StringIO.new(text))
99

1010
assert_equal(text.to_json, filepart.to_json)
11+
assert_equal(text.to_yaml, filepart.to_yaml)
1112
end
1213
end

0 commit comments

Comments
 (0)