Class: T::Types::Simple
Overview
Validates that an object belongs to the specified class.
Instance Attribute Summary collapse
-
#raw_type ⇒ Object
readonly
Returns the value of attribute raw_type.
Instance Method Summary collapse
-
#initialize(raw_type) ⇒ Simple
constructor
A new instance of Simple.
- #name ⇒ Object
- #valid?(obj) ⇒ Boolean
Methods inherited from Base
#==, #describe_obj, #error_message_for_obj, #hash, method_added, #subtype_of?, #to_s, #validate!
Constructor Details
#initialize(raw_type) ⇒ Simple
Returns a new instance of Simple.
9 10 11 |
# File 'lib/types/types/simple.rb', line 9 def initialize(raw_type) @raw_type = raw_type end |
Instance Attribute Details
#raw_type ⇒ Object (readonly)
Returns the value of attribute raw_type.
7 8 9 |
# File 'lib/types/types/simple.rb', line 7 def raw_type @raw_type end |
Instance Method Details
#name ⇒ Object
14 15 16 |
# File 'lib/types/types/simple.rb', line 14 def name @raw_type.name end |
#valid?(obj) ⇒ Boolean
19 20 21 |
# File 'lib/types/types/simple.rb', line 19 def valid?(obj) obj.is_a?(@raw_type) end |