karouf/kanbanize

View on GitHub
lib/kanbanize/board/column.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Kanbanize
  class Board
    class Column
      attr_reader :name, :position, :board

      def initialize(board, attributes)
        @board = board
        @name = attributes['lcname']
        @position = attributes['position'].to_i
      end

      def ==(other)
        @name == other.name && @position == other.position
      end

      def lane(name)
        Cell.new(self, @board.lane(name))
      end
      alias_method :[], :lane

      def tasks
        @tasks ||= tasks!
      end

      def tasks!
        @tasks = @board.tasks!.select{|t| t.column == self}
      end
    end
  end
end