Sha256: 0a713e2c9e1437fdcfd6839d4231bbcd1e079137b8bfc28ed913ebd191d9f610

Contents?: true

Size: 319 Bytes

Versions: 4

Compression:

Stored size: 319 Bytes

Contents

module Mongoid
  module Report

    ReportProxy = Struct.new(:context, :name) do
      def attach_to(model, options = {}, &block)
        as = options.fetch(:as) { model.collection.name }

        options.merge!(as: "#{name}-#{as}") if as

        context.attach_to(model, options, &block)
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-report-0.1.1 lib/mongoid/report/report_proxy.rb
mongoid-report-0.1.0 lib/mongoid/report/report_proxy.rb
mongoid-report-0.0.11 lib/mongoid/report/report_proxy.rb
mongoid-report-0.0.10 lib/mongoid/report/report_proxy.rb