File tree 2 files changed +6
-8
lines changed 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -57,23 +57,21 @@ class Silencer
57
57
| ~
58
58
)$}x . freeze
59
59
60
+ # TODO: deprecate these mutators; use attr_reader instead
60
61
attr_accessor :only_patterns , :ignore_patterns
61
62
62
- def initialize
63
- configure ( { } )
63
+ def initialize ( options = { } )
64
+ configure ( options )
64
65
end
65
66
67
+ # TODO: deprecate this mutator
66
68
def configure ( options )
67
69
@only_patterns = options [ :only ] ? Array ( options [ :only ] ) : nil
68
70
@ignore_patterns = _init_ignores ( options [ :ignore ] , options [ :ignore! ] )
69
71
end
70
72
71
- # Note: relative_path is temporarily expected to be a relative Pathname to
72
- # make refactoring easier (ideally, it would take a string)
73
-
74
- # TODO: switch type and path places - and verify
75
73
def silenced? ( relative_path , type )
76
- path = relative_path . to_s
74
+ path = relative_path . to_s # in case it is a Pathname
77
75
78
76
_ignore? ( path ) || ( only_patterns && type == :file && !_only? ( path ) )
79
77
end
Original file line number Diff line number Diff line change 6
6
7
7
RSpec . describe Listen ::Silencer do
8
8
let ( :options ) { { } }
9
- before { subject . configure ( options ) }
9
+ subject { described_class . new ( options ) }
10
10
11
11
describe '#silenced?' do
12
12
it { should accept ( :file , Pathname ( 'some_dir' ) . join ( "some_file.rb" ) ) }
You can’t perform that action at this time.
0 commit comments