Class: WFlt
- Inherits:
-
Object
show all
- Defined in:
- lib/wflt.rb
Constant Summary
collapse
- VERSION =
[0, 1]
- @@flag =
false
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(io) ⇒ WFlt
Returns a new instance of WFlt.
41
42
43
|
# File 'lib/wflt.rb', line 41
def initialize io
@io = io
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
37
38
39
|
# File 'lib/wflt.rb', line 37
def method_missing name, *args
@io.send name, *args
end
|
Class Method Details
.<<(filter) ⇒ Object
13
14
15
16
|
# File 'lib/wflt.rb', line 13
def << filter
@@filters ||= []
@@filters << filter
end
|
Instance Method Details
#write(line) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/wflt.rb', line 22
def write line
if @@flag && /^\s/ === line
return nil
elsif /warning:/ === line
@@filters ||= []
if @@filters.any? { |flt| flt === line }
@@flag = true
return nil
end
end
@@flag = false
@io.write line
end
|