Module: Warnings::Mixin
- Defined in:
- lib/warnings/mixin.rb
Instance Method Summary collapse
-
#warn(message) ⇒ nil
Registers a warning.
-
#warnings=(mode) ⇒ Boolean
Enables or disables warnings.
-
#warnings? ⇒ Boolean
Determines whether warnings are enabled.
Instance Method Details
#warn(message) ⇒ nil
Registers a warning.
44 45 46 47 48 49 50 51 52 |
# File 'lib/warnings/mixin.rb', line 44 def warn() if warnings? $stderr.puts() if $DEBUG $WARNINGS << Warning.new(,caller) end return nil end |
#warnings=(mode) ⇒ Boolean
Enables or disables warnings.
15 16 17 |
# File 'lib/warnings/mixin.rb', line 15 def warnings=(mode) @warnings = mode end |
#warnings? ⇒ Boolean
Note:
Enabling $VERBOSE
(ruby -w
) or $DEBUG
(ruby -d
) will
enable all warnings by default.
Determines whether warnings are enabled.
29 30 31 |
# File 'lib/warnings/mixin.rb', line 29 def warnings? ($VERBOSE || $DEBUG) || (@warnings != false) end |