Skip to content

Instantly share code, notes, and snippets.

@cpoo22
cpoo22 / excess_extractor.rb
Created February 26, 2020 13:33
Simple hack to extract all the excesses from our models
#To use, put this somewhere on the load path in Chopin OR add its directory to the load path eg. $: << (path to this file)
# require 'excess_extractor'
#
# Then ExcessExtractor.new.show and you will get your out put.
class ExcessExtractor
def show
X_Rated::Rating::Repository.load_all_models
chopin_models = X_Rated::Rating::Repository.rating_models.rating_models['Chopin']
class Extractor
def strip(field)
field&.gsub(/\n/, " ")&.gsub(/<.*?>/, "")
end
def extract(vertical)
questionnaire = X_Rated::Quoting::ChopinEngine.questionnaire_for({ Site: 'uk' }, vertical: vertical)
qs = questionnaire.questions(unasked: true)