Add a attribute? method for the column to a module included in the class.
# File lib/sequel/plugins/boolean_readers.rb, line 44 44: def create_boolean_reader(column) 45: overridable_methods_module.module_eval do 46: define_method("#{column}?"){model.db.typecast_value(:boolean, send(column))} 47: end 48: end
Add attribute? methods for all of the boolean attributes for this model.
# File lib/sequel/plugins/boolean_readers.rb, line 51 51: def create_boolean_readers 52: im = instance_methods.collect{|x| x.to_s} 53: cs = columns rescue return 54: cs.each{|c| create_boolean_reader(c) if boolean_attribute?(c) && !im.include?("#{c}?")} 55: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.