Class: Parlour::Types::Class
Overview
A type which represents the class of a type, rather than an instance. For example, “String” means an instance of String, but “Class(String)” means the actual String class.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #describe ⇒ Object
- #generate_rbi ⇒ Object
- #generate_rbs ⇒ Object
-
#initialize(type) ⇒ Class
constructor
A new instance of Class.
Methods inherited from Type
Constructor Details
#initialize(type) ⇒ Class
Returns a new instance of Class.
406 407 408 |
# File 'lib/parlour/types.rb', line 406 def initialize(type) @type = to_type(type) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
416 417 418 |
# File 'lib/parlour/types.rb', line 416 def type @type end |
Instance Method Details
#==(other) ⇒ Object
411 412 413 |
# File 'lib/parlour/types.rb', line 411 def ==(other) Class === other && type == other.type end |
#describe ⇒ Object
429 430 431 |
# File 'lib/parlour/types.rb', line 429 def describe "Class<#{type.describe}>" end |
#generate_rbi ⇒ Object
419 420 421 |
# File 'lib/parlour/types.rb', line 419 def generate_rbi "T.class_of(#{type.generate_rbi})" end |
#generate_rbs ⇒ Object
424 425 426 |
# File 'lib/parlour/types.rb', line 424 def generate_rbs "singleton(#{type.generate_rbs})" end |