class Cattri::Attribute

def evaluate_default

Raises:
  • (Cattri::AttributeError) - if default evaluation fails

Returns:
  • (Object) - the evaluated default
def evaluate_default
  @options.default.call
rescue StandardError => e
  raise Cattri::AttributeError, "Failed to evaluate the default value for `:#{@options.name}`. Error: #{e.message}"
end