Module: Sequel::Plugins::TypecastOnLoad::ClassMethods
- Defined in:
- lib/sequel/plugins/typecast_on_load.rb
Instance Attribute Summary collapse
-
#typecast_on_load_columns ⇒ Object
readonly
The columns to typecast on load for this model.
Instance Method Summary collapse
-
#add_typecast_on_load_columns(*columns) ⇒ Object
Add additional columns to typecast on load for this model.
-
#inherited(subclass) ⇒ Object
Give the subclass a copy of the typecast on load columns.
-
#load(values) ⇒ Object
Call the setter method for each of the typecast on load columns, ensuring the model object will have the correct typecasting even if the database doesn’t typecast the columns correctly.
Instance Attribute Details
#typecast_on_load_columns ⇒ Object (readonly)
The columns to typecast on load for this model.
32 33 34 |
# File 'lib/sequel/plugins/typecast_on_load.rb', line 32 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.
35 36 37 |
# File 'lib/sequel/plugins/typecast_on_load.rb', line 35 def add_typecast_on_load_columns(*columns) @typecast_on_load_columns.concat(columns) end |
#inherited(subclass) ⇒ Object
Give the subclass a copy of the typecast on load columns.
40 41 42 43 |
# File 'lib/sequel/plugins/typecast_on_load.rb', line 40 def inherited(subclass) super subclass.instance_variable_set(:@typecast_on_load_columns, typecast_on_load_columns.dup) end |
#load(values) ⇒ Object
Call the setter method for each of the typecast on load columns, ensuring the model object will have the correct typecasting even if the database doesn’t typecast the columns correctly.
48 49 50 |
# File 'lib/sequel/plugins/typecast_on_load.rb', line 48 def load(values) super.load_typecast end |