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. 
- 
  
    
      #call(values)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Typecast values using #load_typecast when the values are retrieved from the database. 
- 
  
    
      #freeze  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Freeze typecast on load columns when freezing model class. 
Instance Attribute Details
#typecast_on_load_columns ⇒ Object (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 46 47 | # File 'lib/sequel/plugins/typecast_on_load.rb', line 43 def call(values) o = super.load_typecast o.send(:_clear_changed_columns, :initialize) o end | 
#freeze ⇒ Object
Freeze typecast on load columns when freezing model class.
| 50 51 52 53 54 | # File 'lib/sequel/plugins/typecast_on_load.rb', line 50 def freeze @typecast_on_load_columns.freeze super end |