Class: RBI::Type::Generic
Overview
A generic type like ‘T::Array` or `T::Hash[Symbol, Integer]`.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
: String.
-
#params ⇒ Object
readonly
: Array.
Instance Method Summary collapse
-
#==(other) ⇒ Object
: (BasicObject other) -> bool.
-
#initialize(name, *params) ⇒ Generic
constructor
: (String name, *Type params) -> 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(name, *params) ⇒ Generic
: (String name, *Type params) -> void
285 286 287 288 289 |
# File 'lib/rbi/type.rb', line 285 def initialize(name, *params) super() @name = name @params = params #: Array[Type] end |
Instance Attribute Details
#name ⇒ Object (readonly)
: String
279 280 281 |
# File 'lib/rbi/type.rb', line 279 def name @name end |
#params ⇒ Object (readonly)
: Array
282 283 284 |
# File 'lib/rbi/type.rb', line 282 def params @params end |
Instance Method Details
#==(other) ⇒ Object
: (BasicObject other) -> bool
293 294 295 |
# File 'lib/rbi/type.rb', line 293 def ==(other) Generic === other && @name == other.name && @params == other.params end |
#to_rbi ⇒ Object
: -> String
299 300 301 |
# File 'lib/rbi/type.rb', line 299 def to_rbi "#{@name}[#{@params.map(&:to_rbi).join(", ")}]" end |