lib/volt/reactive/reactive_block.rb
def change_cell_count(size)
    current_size = @cell_trackers.size

    if current_size < size
      # Add trackers

      current_size.upto(size-1) do |index|
        # Get the reactive value for the index
        val = @source[index]

        result = @check_block.call(val)

        @cell_trackers << result.on('changed') do
          puts "RESULT CHANGED: #{index} - #{self.object_id}"
          trigger!('changed')
        end
      end
    elsif current_size > size
      (current_size-1).downto(size) do |index|
        @cell_trackers[index].remove
        @cell_trackers.delete_at(index)
      end
    end
  end
# We need to make sure we're listening on the result from each cell,
# that way we can trigger when the value changes.
We need to make sure we're listening on the result from each cell,
that way we can trigger when the value changes.
We need to make sure we ' re listening on the result from each cell that way we can trigger when the value changes .
def change_cell_count(size)
    current_size = @cell_trackers.size
    if current_size < size
      current_size.upto(size-1) do |index|
        val = @source[index]
        result = @check_block.call(val)
        @cell_trackers << result.on('changed') do
          puts "RESULT CHANGED: #{index} - #{self.object_id}"
          trigger!('changed')
        end
      end
    elsif current_size > size
      (current_size-1).downto(size) do |index|
        @cell_trackers[index].remove
        @cell_trackers.delete_at(index)
      end
    end
  end
def change_cell_count ( size ) current_size = @cell_trackers . size if current_size < size current_size . upto ( size - 1 ) do | index | val = @source [ index ] result = @check_block . call ( val ) @cell_trackers << result . on ( 'changed' ) do puts "RESULT CHANGED: #{index} - #{self.object_id}" trigger! ( 'changed' ) end end elsif current_size > size ( current_size - 1 ) . downto ( size ) do | index | @cell_trackers [ index ] . remove @cell_trackers . delete_at ( index ) end end end
We need to make sure we're listening on the result from each cell,
that way we can trigger when the value changes.
We need to make sure we ' re listening on the result from each cell that way we can trigger when the value changes .
# Add trackers # Get the reactive value for the index
size