Module: Sequel::Plugins::DefaultsSetter::ClassMethods

Defined in:
lib/sequel/plugins/defaults_setter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_valuesObject (readonly)

The default values to use for this model. A hash with column symbol keys and default values. If the default values respond to call, it will be called to get the value, otherwise the value will be used directly. You can manually modify this hash to set specific default values, by default the ones will be parsed from the database.



75
76
77
# File 'lib/sequel/plugins/defaults_setter.rb', line 75

def default_values
  @default_values
end

Instance Method Details

#cache_default_values?Boolean

Whether default values should be cached in the values hash after being retrieved.

Returns:

  • (Boolean)


82
83
84
# File 'lib/sequel/plugins/defaults_setter.rb', line 82

def cache_default_values?
  @cache_default_values
end

#freezeObject

Freeze default values when freezing model class



87
88
89
90
# File 'lib/sequel/plugins/defaults_setter.rb', line 87

def freeze
  @default_values.freeze
  super
end