Methods
Public Instance
Attributes
input_transformers | [R] |
|
Public Instance methods
add_input_transformer(transformer_name, &block)
Add an input transformer to this model.
[show source]
# File lib/sequel/plugins/input_transformer.rb 52 def add_input_transformer(transformer_name, &block) 53 raise(Error, 'must provide both transformer name and block when adding input transformer') unless transformer_name && block 54 @input_transformers[transformer_name] = block 55 @skip_input_transformer_columns[transformer_name] = [] 56 end
freeze()
Freeze input transformers when freezing model class
[show source]
# File lib/sequel/plugins/input_transformer.rb 59 def freeze 60 @input_transformers.freeze 61 @skip_input_transformer_columns.freeze.each_value(&:freeze) 62 63 super 64 end
input_transformer_order()
The order in which to call the input transformers. For backwards compatibility only.
[show source]
# File lib/sequel/plugins/input_transformer.rb 45 def input_transformer_order 46 input_transformers.keys.reverse 47 end
skip_input_transformer(transformer_name, *columns)
Set columns that the transformer should skip.
[show source]
# File lib/sequel/plugins/input_transformer.rb 67 def skip_input_transformer(transformer_name, *columns) 68 @skip_input_transformer_columns[transformer_name].concat(columns).uniq! 69 end
skip_input_transformer?(transformer_name, column)
Return true if the transformer should not be called for the given column.
[show source]
# File lib/sequel/plugins/input_transformer.rb 72 def skip_input_transformer?(transformer_name, column) 73 @skip_input_transformer_columns[transformer_name].include?(column) 74 end