class Attrio::DefaultValue::Base

Attributes

attribute[R]
value[R]

Public Class Methods

handle(attribute, value) click to toggle source
# File lib/attrio/default_value/base.rb, line 8
def self.handle(attribute, value)
  handler = [
    Attrio::DefaultValue::Callable,
    Attrio::DefaultValue::Clonable,
    Attrio::DefaultValue::Symbol
  ].detect{ |handler| handler.handle?(value) }

  handler.new(attribute, value) if handler.present?
end
new(attribute, value) click to toggle source
# File lib/attrio/default_value/base.rb, line 18
def initialize(attribute, value)
  @attribute = attribute; @value = value;
end

Public Instance Methods

call(instance) click to toggle source

Evaluates the value @return [Object] evaluated value

# File lib/attrio/default_value/base.rb, line 25
def call(instance)
  raise NotImplementedError
end