diff --git a/lib/bulletmark_repairer.rb b/lib/bulletmark_repairer.rb index d2deffb..e6fd75c 100644 --- a/lib/bulletmark_repairer.rb +++ b/lib/bulletmark_repairer.rb @@ -4,6 +4,7 @@ require 'bulletmark_repairer/railtie' if ENV['REPAIR'] require 'bulletmark_repairer/bulletmark_repairer' require 'bulletmark_repairer/associations_builder' +require 'bulletmark_repairer/configuration' require 'bulletmark_repairer/corrector_builder' require 'bulletmark_repairer/markers' require 'bulletmark_repairer/patcher' diff --git a/lib/bulletmark_repairer/configuration.rb b/lib/bulletmark_repairer/configuration.rb new file mode 100644 index 0000000..40e01d7 --- /dev/null +++ b/lib/bulletmark_repairer/configuration.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module BulletmarkRepairer + class Configration + attr_writer :development + + def initialize + @development = false + end + + def development? + @development + end + end + + class << self + def configure + yield config + end + + def config + @config ||= Configration.new + end + end +end diff --git a/lib/bulletmark_repairer/rack.rb b/lib/bulletmark_repairer/rack.rb index d4048c9..a58c475 100644 --- a/lib/bulletmark_repairer/rack.rb +++ b/lib/bulletmark_repairer/rack.rb @@ -19,8 +19,7 @@ def call(env) ) end rescue StandardError => e - # TODO: handle error - raise e + raise e if BulletmarkRepairer.config.development? end end end