| Module | SmartleafSymbolColumn |
| In: |
lib/symbol_column.rb
|
Mixin that adds a "symbol_column" declaration to a class. After including this module, if ‘frob’ is a string-valued column of table foo, and the definition of Foo in foo.rb declares
symbol_column :frob
then the following will work:
my_foo = Foo.new :frob => :frog my_foo.frob = :frill
and reading my_foo.frob will likewise return a symbol, not a string. Also, for UI convenience:
my_foo.frob = 'frill' assert_equal :frill, my_foo.frob
will succeed — we apply to_sym going in as well as coming out.