Skip to content

Commit

Permalink
Introduce Configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
makicamel committed Oct 9, 2023
1 parent 1d230d3 commit c715b4b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/bulletmark_repairer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
25 changes: 25 additions & 0 deletions lib/bulletmark_repairer/configuration.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions lib/bulletmark_repairer/rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c715b4b

Please sign in to comment.