Class: Mongoid::Report::ReportProxy

Inherits:
Struct
  • Object
show all
Defined in:
lib/mongoid/report/report_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context

Returns:

  • (Object)

    the current value of context



6
7
8
# File 'lib/mongoid/report/report_proxy.rb', line 6

def context
  @context
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



6
7
8
# File 'lib/mongoid/report/report_proxy.rb', line 6

def name
  @name
end

Instance Method Details

#attach_proxyObject



7
8
9
10
11
# File 'lib/mongoid/report/report_proxy.rb', line 7

def attach_proxy
  @attach_proxy ||= begin
    AttachProxy.new(context, nil, report_module: name)
  end
end

#attach_to(*fields, &block) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/mongoid/report/report_proxy.rb', line 15

def attach_to(*fields, &block)
  options = fields.extract_options!
  model   = fields[0]

  report_name = options.delete(:as) || Collections.name(model)
  options.merge!(report_module: name, as: report_name)

  context.attach_to(*fields, options, &block)
end