Class: T::Private::Types::StringHolder

Inherits:
Types::Base show all
Defined in:
lib/types/private/types/string_holder.rb

Overview

Holds a string. Useful for showing type aliases in error messages

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Types::Base

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

Constructor Details

#initialize(string) ⇒ StringHolder

Returns a new instance of StringHolder.



8
9
10
# File 'lib/types/private/types/string_holder.rb', line 8

def initialize(string)
  @string = string
end

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



6
7
8
# File 'lib/types/private/types/string_holder.rb', line 6

def string
  @string
end

Instance Method Details

#build_typeObject



12
13
14
# File 'lib/types/private/types/string_holder.rb', line 12

def build_type
  nil
end

#nameObject

overrides Base



17
18
19
# File 'lib/types/private/types/string_holder.rb', line 17

def name
  string
end

#valid?(obj) ⇒ Boolean

overrides Base

Returns:



22
23
24
# File 'lib/types/private/types/string_holder.rb', line 22

def valid?(obj)
  false
end