Module: Sequel::Plugins::TypecastOnLoad::ClassMethods

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#typecast_on_load_columnsObject (readonly)

The columns to typecast on load for this model.



34
35
36
# File 'lib/sequel/plugins/typecast_on_load.rb', line 34

def typecast_on_load_columns
  @typecast_on_load_columns
end

Instance Method Details

#add_typecast_on_load_columns(*columns) ⇒ Object

Add additional columns to typecast on load for this model.



37
38
39
# File 'lib/sequel/plugins/typecast_on_load.rb', line 37

def add_typecast_on_load_columns(*columns)
  @typecast_on_load_columns.concat(columns)
end

#call(values) ⇒ Object

Typecast values using #load_typecast when the values are retrieved from the database.



43
44
45
# File 'lib/sequel/plugins/typecast_on_load.rb', line 43

def call(values)
  super.load_typecast
end

#freezeObject

Freeze typecast on load columns when freezing model class.



48
49
50
51
52
# File 'lib/sequel/plugins/typecast_on_load.rb', line 48

def freeze
  @typecast_on_load_columns.freeze

  super
end