Object
# File rbs-2.1.0/lib/rbs/types.rb, line 524
def ==(other)
other.is_a?(Optional) && other.type == type
end
# File rbs-2.1.0/lib/rbs/types.rb, line 558
def each_type
if block_given?
yield type
else
enum_for :each_type
end
end
# File rbs-2.1.0/lib/rbs/types.rb, line 534
def free_variables(set = Set.new)
type.free_variables(set)
end
# File rbs-2.1.0/lib/rbs/types.rb, line 530
def hash
self.class.hash ^ type.hash
end
# File rbs-2.1.0/lib/rbs/types.rb, line 573
def map_type(&block)
if block
Optional.new(
type: yield(type),
location: location
)
else
enum_for :map_type
end
end
# File rbs-2.1.0/lib/rbs/types.rb, line 566
def map_type_name(&block)
Optional.new(
type: type.map_type_name(&block),
location: location
)
end
# File rbs-2.1.0/lib/rbs/types.rb, line 542
def sub(s)
self.class.new(type: type.sub(s), location: location)
end