Module: Bumblebee::ColumnDsl

Extended by:
Forwardable
Included in:
Template
Defined in:
lib/bumblebee/column_dsl.rb

Overview

Defines a class-level interace for specifying columns.

Instance Method Summary collapse

Instance Method Details

#all_column_setsObject



27
28
29
30
31
32
# File 'lib/bumblebee/column_dsl.rb', line 27

def all_column_sets
  # the reverse preserves the order of inheritance to go from parent -> child
  ancestors.reverse_each.with_object(ColumnSet.new) do |ancestor, set|
    ancestor < Template ? set.add(ancestor.columns) : set
  end
end

#all_columnsObject



34
35
36
# File 'lib/bumblebee/column_dsl.rb', line 34

def all_columns
  all_column_sets.columns
end

#column(header, opts = {}) ⇒ Object



21
22
23
24
25
# File 'lib/bumblebee/column_dsl.rb', line 21

def column(header, opts = {})
  column_set.column(header, opts)

  self
end

#column_setObject



17
18
19
# File 'lib/bumblebee/column_dsl.rb', line 17

def column_set
  @column_set ||= ColumnSet.new
end