Module: Warnings
- Defined in:
- lib/warnings/mixin.rb,
lib/warnings/version.rb,
lib/warnings/warning.rb,
lib/warnings/warnings.rb
Defined Under Namespace
Modules: Mixin Classes: Warning
Constant Summary collapse
- VERSION =
warnings version
"0.1.1"
Class Method Summary collapse
-
.from(path) ⇒ Warning
Selects all warnings originating from a file.
-
.from_method(name) ⇒ Warning
Selects all warnings originating from a method.
-
.grep(pattern) ⇒ Warning
Selects all warnings with a similar message.
Class Method Details
.from(path) ⇒ Warning
Selects all warnings originating from a file.
45 46 47 |
# File 'lib/warnings/warnings.rb', line 45 def self.from(path) $WARNINGS.select { |warning| warning.source_file.include?(path) } end |
.from_method(name) ⇒ Warning
Selects all warnings originating from a method.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/warnings/warnings.rb', line 58 def self.from_method(name) selector = case name when Regexp lambda { |warning| warning.source_method =~ name } else lambda { |warning| warning.source_method == name } end $WARNINGS.select(&selector) end |
.grep(pattern) ⇒ Warning
Selects all warnings with a similar message.
32 33 34 |
# File 'lib/warnings/warnings.rb', line 32 def self.grep(pattern) $WARNINGS.select { |warning| warning..match(pattern) } end |