Module: Taro::Types::Shared::TypeClass

Defined in:
lib/taro/types/shared/type_class.rb

Overview

‘type_class` is a convenience method to get the type class of types, of with_cache-types, of type instances, and of fields in the same way.

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/taro/types/shared/type_class.rb', line 4

def self.included(klass)
  if klass.instance_methods.include?(:type) # Field
    klass.alias_method                 :type_class, :type
  else # BaseType
    klass.singleton_class.alias_method :type_class, :itself
    klass.alias_method                 :type_class, :class
  end
end