class Virtus::PendingAttribute

Attribute placeholder used when type constant is passed as a string or symbol

@private

Attributes

name[R]
options[R]
type[R]

Public Class Methods

new(type, options) click to toggle source

@api private

# File lib/virtus/attribute/builder.rb, line 10
def initialize(type, options)
  @type, @options = type.to_s, options
  @name = options[:name]
end

Public Instance Methods

determine_type() click to toggle source

@api private

# File lib/virtus/attribute/builder.rb, line 26
def determine_type
  if type.include?('::')
    # TODO: wrap it up in Virtus.constantize and use feature-detection to
    #       pick up either Inflecto or ActiveSupport, whateve is available
    if defined?(Inflecto)
      Inflecto.constantize(type)
    else
      raise NotImplementedError, 'Virtus needs inflecto gem to constantize namespaced constant names'
    end
  else
    Object.const_get(type)
  end
end
finalize() click to toggle source

@api private

# File lib/virtus/attribute/builder.rb, line 16
def finalize
  Attribute::Builder.call(determine_type, options).finalize
end
finalized?() click to toggle source

@api private

# File lib/virtus/attribute/builder.rb, line 21
def finalized?
  false
end