class Parlour::Types::Nilable

A type which can be either the wrapped type, or nil.

Attributes

type[R]

Public Class Methods

new(type) click to toggle source
# File lib/parlour/types.rb, line 78
def initialize(type)
  @type = to_type(type)
end

Public Instance Methods

==(other) click to toggle source
# File lib/parlour/types.rb, line 83
def ==(other)
  Nilable === other && type == other.type
end
describe() click to toggle source
# File lib/parlour/types.rb, line 101
def describe
  "Nilable<#{type.describe}>"
end
generate_rbi() click to toggle source
# File lib/parlour/types.rb, line 91
def generate_rbi
  "T.nilable(#{type.generate_rbi})"
end
generate_rbs() click to toggle source
# File lib/parlour/types.rb, line 96
def generate_rbs
  "#{type.generate_rbs}?"
end