Class: T::Types::TypeParameter

Inherits:
Base
  • Object
show all
Defined in:
lib/types/types/type_parameter.rb

Instance Method Summary collapse

Methods inherited from Base

#==, #describe_obj, #error_message_for_obj, #hash, method_added, #subtype_of?, #to_s, #validate!

Constructor Details

#initialize(name) ⇒ TypeParameter

Returns a new instance of TypeParameter.

Raises:

  • (ArgumentError)


6
7
8
9
# File 'lib/types/types/type_parameter.rb', line 6

def initialize(name)
  raise ArgumentError.new("not a symbol: #{name}") unless name.is_a?(Symbol)
  @name = name
end

Instance Method Details

#nameObject



19
20
21
# File 'lib/types/types/type_parameter.rb', line 19

def name
  "T.type_parameter(#{@name})"
end

#subtype_of_single?(type) ⇒ Boolean

Returns:



15
16
17
# File 'lib/types/types/type_parameter.rb', line 15

def subtype_of_single?(type)
  true
end

#valid?(obj) ⇒ Boolean

Returns:



11
12
13
# File 'lib/types/types/type_parameter.rb', line 11

def valid?(obj)
  true
end