Module: Noventius::Report::Dsl::Columns::ClassMethods

Included in:
Noventius::Report::Dsl::ClassMethods
Defined in:
lib/noventius/report/dsl/columns.rb

Instance Method Summary collapse

Instance Method Details

#column(name, type, options = {}) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/noventius/report/dsl/columns.rb', line 24

def column(name, type, options = {})
  validate_name_not_taken!(name)

  Column.new(name, type, options).tap do |column|
    columns_names << column.name
    columns << column
  end
end

#columnsObject



16
17
18
# File 'lib/noventius/report/dsl/columns.rb', line 16

def columns
  @columns ||= []
end

#columns_group(name, children, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/noventius/report/dsl/columns.rb', line 33

def columns_group(name, children, options = {})
  validate_name_not_taken!(name)

  ColumnsGroup.new(name, children, options).tap do |columns_group|
    columns_names << columns_group.name
    children.map { |child| columns.delete(child) }

    columns << columns_group
  end
end

#columns_namesObject



20
21
22
# File 'lib/noventius/report/dsl/columns.rb', line 20

def columns_names
  @columns_names ||= []
end

#dynamic_columns(method_name) ⇒ Object



44
45
46
# File 'lib/noventius/report/dsl/columns.rb', line 44

def dynamic_columns(method_name)
  columns << -> { send(method_name) }
end