Module: Noventius::Report::Dsl::Nested::InstanceMethods

Included in:
InstanceMethods
Defined in:
lib/noventius/report/dsl/nested.rb

Instance Method Summary collapse

Instance Method Details

#build_nested_report(row) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/noventius/report/dsl/nested.rb', line 48

def build_nested_report(row)
  row ||= []

  nested_filters = nested_options[:filters] || filter_params
  nested_filters = public_send(nested_filters, row) if nested_filters.is_a?(Symbol)
  nested_filters = instance_exec(row, &nested_filters) if nested_filters.is_a?(Proc)

  self.class.nested_report_class.new(nested_filters)
end

#enable_nested?Boolean

Returns:

  • (Boolean)


36
37
38
39
40
41
42
43
44
45
46
# File 'lib/noventius/report/dsl/nested.rb', line 36

def enable_nested?
  return @enable_nested unless @enable_nested.nil?

  return false unless self.class.includes_nested?

  @enable_nested = nested_options.fetch(:if, true)
  @enable_nested = public_send(@enable_nested) if @enable_nested.is_a?(Symbol)
  @enable_nested = instance_exec(&@enable_nested) if @enable_nested.is_a?(Proc)

  @enable_nested
end

#nested_optionsObject



32
33
34
# File 'lib/noventius/report/dsl/nested.rb', line 32

def nested_options
  self.class.nested_options
end