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

#nameObject

overrides Base



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

def name
  string
end

#valid?(obj) ⇒ Boolean

overrides Base

Returns:



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

def valid?(obj)
  false
end