Class: Plutonium::Kanban::Board

Inherits:
Object
  • Object
show all
Defined in:
lib/plutonium/kanban/board.rb

Constant Summary collapse

VALID_SHOW_IN =

nil means "inherit the definition's show_in"; the board only overrides when explicitly set to :modal or :page.

[nil, :modal, :page].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns:, columns_block:, card_fields:, per_column:, realtime:, position_config:, lazy:, show_in: nil) ⇒ Board

Returns a new instance of Board.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/plutonium/kanban/board.rb', line 12

def initialize(columns:, columns_block:, card_fields:, per_column:, realtime:, position_config:, lazy:, show_in: nil)
  unless VALID_SHOW_IN.include?(show_in)
    raise ArgumentError, "show_in must be one of #{VALID_SHOW_IN.compact.inspect} (or unset), got #{show_in.inspect}"
  end

  @columns = columns
  @columns_block = columns_block
  @card_fields = card_fields
  @per_column = per_column
  @realtime = realtime
  @position_config = position_config
  @lazy = lazy
  @show_in = show_in
  @columns.each(&:freeze)
  @columns.freeze
  @card_fields&.freeze
  freeze
end

Instance Attribute Details

#card_fieldsObject (readonly)

Returns the value of attribute card_fields.



6
7
8
# File 'lib/plutonium/kanban/board.rb', line 6

def card_fields
  @card_fields
end

#columnsObject (readonly)

Returns the value of attribute columns.



6
7
8
# File 'lib/plutonium/kanban/board.rb', line 6

def columns
  @columns
end

#columns_blockObject (readonly)

Returns the value of attribute columns_block.



6
7
8
# File 'lib/plutonium/kanban/board.rb', line 6

def columns_block
  @columns_block
end

#per_columnObject (readonly)

Returns the value of attribute per_column.



6
7
8
# File 'lib/plutonium/kanban/board.rb', line 6

def per_column
  @per_column
end

#position_configObject (readonly)

Returns the value of attribute position_config.



6
7
8
# File 'lib/plutonium/kanban/board.rb', line 6

def position_config
  @position_config
end

#show_inObject (readonly)

Returns the value of attribute show_in.



6
7
8
# File 'lib/plutonium/kanban/board.rb', line 6

def show_in
  @show_in
end

Instance Method Details

#dynamic?Boolean

Returns:

  • (Boolean)


33
# File 'lib/plutonium/kanban/board.rb', line 33

def dynamic? = !@columns_block.nil?

#lazy?Boolean

Returns:

  • (Boolean)


32
# File 'lib/plutonium/kanban/board.rb', line 32

def lazy? = !!@lazy

#realtime?Boolean

Returns:

  • (Boolean)


31
# File 'lib/plutonium/kanban/board.rb', line 31

def realtime? = !!@realtime

#show_in_for(definition) ⇒ Object

Resolves the board's effective show_in, falling back to the definition's show_in when the board doesn't override it. Pass the resource definition.



37
# File 'lib/plutonium/kanban/board.rb', line 37

def show_in_for(definition) = @show_in || definition.show_in