Class: RBI::Type::Nilable
Overview
A type that can be ‘nil` like `T.nilable(String)`.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
: Type.
Instance Method Summary collapse
-
#==(other) ⇒ Object
: (BasicObject other) -> bool.
-
#initialize(type) ⇒ Nilable
constructor
: (Type type) -> void.
-
#to_rbi ⇒ Object
: -> String.
Methods inherited from RBI::Type
all, any, anything, attached_class, boolean, class_of, #eql?, generic, #hash, #nilable, nilable, #nilable?, #non_nilable, noreturn, parse_node, parse_string, proc, #rbs_string, self_type, shape, simple, t_class, #to_s, tuple, type_parameter, untyped, void
Constructor Details
#initialize(type) ⇒ Nilable
: (Type type) -> void
211 212 213 214 |
# File 'lib/rbi/type.rb', line 211 def initialize(type) super() @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
: Type
208 209 210 |
# File 'lib/rbi/type.rb', line 208 def type @type end |
Instance Method Details
#==(other) ⇒ Object
: (BasicObject other) -> bool
218 219 220 |
# File 'lib/rbi/type.rb', line 218 def ==(other) Nilable === other && @type == other.type end |
#to_rbi ⇒ Object
: -> String
224 225 226 |
# File 'lib/rbi/type.rb', line 224 def to_rbi "T.nilable(#{@type.to_rbi})" end |