Module: Hoe::Halostatue::StrictWarnings
- Defined in:
- lib/hoe/halostatue/strict_warnings.rb
Overview
:nodoc:
Constant Summary collapse
- WarningError =
Class.new(StandardError)
Class Attribute Summary collapse
-
.allowed ⇒ Object
Returns the value of attribute allowed.
-
.project_root ⇒ Object
Returns the value of attribute project_root.
-
.suppressed ⇒ Object
Returns the value of attribute suppressed.
Instance Method Summary collapse
Class Attribute Details
.allowed ⇒ Object
Returns the value of attribute allowed.
9 10 11 |
# File 'lib/hoe/halostatue/strict_warnings.rb', line 9 def allowed @allowed end |
.project_root ⇒ Object
Returns the value of attribute project_root.
8 9 10 |
# File 'lib/hoe/halostatue/strict_warnings.rb', line 8 def project_root @project_root end |
.suppressed ⇒ Object
Returns the value of attribute suppressed.
10 11 12 |
# File 'lib/hoe/halostatue/strict_warnings.rb', line 10 def suppressed @suppressed end |
Instance Method Details
#warn(message) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/hoe/halostatue/strict_warnings.rb', line 23 def warn(, ...) pattern = Hoe::Halostatue::StrictWarnings.suppressed return if pattern&.match?() super return unless ENV["STRICT_WARNINGS"] || ENV["CI"] project_root = Hoe::Halostatue::StrictWarnings.project_root return if project_root && !.include?(project_root) pattern = Hoe::Halostatue::StrictWarnings.allowed return if pattern&.match?() raise WarningError.new() end |