This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReportBuilder | |
include GlobalID::Identification | |
def id | |
report.id | |
end | |
def self.find id | |
new(report_class.find(id)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReportMailer < ApplicationMailer | |
def new_report_email recipient, report_builder | |
attachments['report.pdf'] = { mime_type: 'application/pdf', content: report_builder.generate_stream } | |
mail(to: recipient, subject: report_builder.title) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmailReportJob < ActiveJob::Base | |
queue_as :mail | |
def perform recipients, report_builder | |
recipients.each do |recipient| | |
ReportMailer.new_report_email(recipient, report_builder).deliver | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JsonWrapper | |
class Base | |
MAPPING_TYPES = { | |
array: :to_a, | |
boolean: :to_bool, | |
date: :to_date, | |
datetime: :to_datetime, | |
float: :to_f, | |
hash: :to_h, | |
integer: :to_i, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const keyMirror = (list, namespace) => { | |
let newList= {}; | |
let prefix = namespace ? namespace + ":" : ""; | |
Object.keys(list).map(element => { | |
var key = String(element); | |
newList[key] = prefix + element | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require: | |
- rubocop-rails | |
Rails: | |
Enabled: true | |
Metrics/ClassLength: | |
Enabled: false | |
Metrics/AbcSize: | |
Enabled: false | |
Metrics/LineLength: |
OlderNewer