Sha256: 0bc673a13a3c3aacce8f63f9e6c2b4ea71301f6afcc5a812183a0ccac6a42734
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require "pathname" module WarningsLogger class Configuration attr_writer :project_name def initialize @project_name = nil @project_directory = nil end def update! yield self end def project_name if @project_name @project_name else raise NotConfiguredError.new(<<~EXAMPLE) WarningsLogger.configure do |config| config.project_name = "your_project_name" end EXAMPLE end end def project_directory if @project_directory @project_directory else raise NotConfiguredError.new(<<~EXAMPLE) WarningsLogger.configure do |config| config.project_directory = "/path/to/your/project/directory" end EXAMPLE end end def project_directory=(path) @project_directory = Pathname.new(path) end class NotConfiguredError < StandardError def initialize(example) super(<<~MESSAGE) You need to configure WarningsLogger before you can use it! For example: #{example} MESSAGE end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
warnings_logger-0.1.1 | lib/warnings_logger/configuration.rb |