Sha256: 4800e70998972890b0fffe61f29d77f40ac8e7fba72f8122461f96c722658efb
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module Clevic class FilterCommand # filter_block will be passed a Dataset to filter. # filter_message will be displayed. def initialize( table_view, message, &filter_block ) @table_view = table_view @message = message @filter_block = filter_block end attr_reader :message # Do the filtering. Return true if successful, false otherwise. def doit # store current dataset @previous_dataset = @table_view.model.cache_table.dataset # store auto_new @auto_new = @table_view.model.auto_new # reload cache table with new conditions @table_view.model.auto_new = false @table_view.model.reload_data( &@filter_block ) true rescue Exception => e puts puts e.message puts e.backtrace false end def undo # restore auto_new @table_view.model.auto_new = @auto_new # reload cache table with stored AR conditions @table_view.model.reload_data( @previous_dataset ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
clevic-0.13.0.b6 | lib/clevic/filter_command.rb |
clevic-0.13.0.b5 | lib/clevic/filter_command.rb |