class Virtus::Attribute::DefaultValue

Class representing the default value option

@api private

Attributes

value[R]

Returns the value instance

@return [Object]

@api private

Public Class Methods

build(*args) click to toggle source

Builds a default value instance

@return [Virtus::Attribute::DefaultValue]

@api private

# File lib/virtus/attribute/default_value.rb, line 15
def self.build(*args)
  klass = descendants.detect { |descendant| descendant.handle?(*args) } || self
  klass.new(*args)
end
new(value) click to toggle source

Initializes an default value instance

@param [Object] value

@return [undefined]

@api private

# File lib/virtus/attribute/default_value.rb, line 34
def initialize(value)
  @value = value
end

Public Instance Methods

call(*) click to toggle source

Evaluates the value

@return [Object] evaluated value

@api private

# File lib/virtus/attribute/default_value.rb, line 43
def call(*)
  value
end