Skip to content

Commit 4bf209e

Browse files
raosushhsbt
authored andcommitted
Marshal: Load, dump for TypeParameter
1 parent 9b65449 commit 4bf209e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/rdoc/type_parameter.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@ module RDoc
22
class TypeParameter < CodeObject
33
attr_reader :name, :variance, :unchecked, :upper_bound
44

5+
MARSHAL_VERSION = 3 # :nodoc:
6+
57
def initialize(name, variance, unchecked = false, upper_bound = nil)
68
@name = name
79
@variance = variance
810
@unchecked = unchecked
911
@upper_bound = upper_bound
1012
end
1113

14+
def marshal_load(array)
15+
@name = array[1]
16+
@variance = array[2]
17+
@unchecked = array[3]
18+
@upper_bound = array[4]
19+
end
20+
21+
def marshal_dump
22+
[
23+
MARSHAL_VERSION,
24+
@name,
25+
@variance,
26+
@unchecked,
27+
@upper_bound
28+
]
29+
end
30+
1231
def ==(other)
1332
other.is_a?(TypeParameter) &&
1433
self.name == other.name &&

0 commit comments

Comments
 (0)