class Virtus::TypeDefinition

Extracts the actual type primitive from input type

@private

Attributes

primitive[R]
type[R]

Public Class Methods

new(type) click to toggle source

@api private

# File lib/virtus/attribute/builder.rb, line 49
def initialize(type)
  @type = type
  initialize_primitive
end

Public Instance Methods

pending?() click to toggle source

@api private

# File lib/virtus/attribute/builder.rb, line 55
def pending?
  @pending if defined?(@pending)
end

Private Instance Methods

initialize_primitive() click to toggle source

@api private

# File lib/virtus/attribute/builder.rb, line 62
def initialize_primitive
  @primitive =
    if type.instance_of?(String) || type.instance_of?(Symbol)
      if !type.to_s.include?('::') && Object.const_defined?(type)
        Object.const_get(type)
      elsif not Attribute::Builder.determine_type(type)
        @pending = true
        type
      else
        type
      end
    elsif not type.is_a?(Class)
      type.class
    else
      type
    end
end