def filter_tasks!(options)
      @tasks = @all_tasks.reject(&:children?)

      [:completed, :canceled].each do |filter|
        proc = Proc.new { |e| e.send("#{filter}?") }
        if options.key?(filter)
          if options[filter]
            @tasks = @tasks.select(&proc)
          else
            @tasks = @tasks.reject(&proc)
          end
        end
      end
            
      if tag = options[:tag]
        @tasks = @tasks.select { |t| t.tag?(tag) }
      end
    end
def filter_tasks!(options)
      @tasks = @all_tasks.reject(&:children?)

      [:completed, :canceled].each do |filter|
        proc = Proc.new { |e| e.send("
        if options.key?(filter)
          if options[filter]
            @tasks = @tasks.select(&proc)
          else
            @tasks = @tasks.reject(&proc)
          end
        end
      end
            
      if tag = options[:tag]
        @tasks = @tasks.select { |t| t.tag?(tag) }
      end
    end
def filter_tasks! ( options ) @tasks = @all_tasks . reject ( :children? ) [ :completed , :canceled ] . each do | filter | proc = Proc . new { | e | e . send ( "#{filter}?" ) } if options . key? ( filter ) if options [ filter ] @tasks = @tasks . select ( proc ) else @tasks = @tasks . reject ( proc ) end end end if tag = options [ :tag ] @tasks = @tasks . select { | t | t . tag? ( tag ) } end end
TODO: Smarter task filtering
TODO : Smarter task filtering