Class: FileMonitorFilter
- Inherits:
-
Object
- Object
- FileMonitorFilter
- Defined in:
- lib/file-monitor.rb
Instance Method Summary collapse
- #allow(pattern) ⇒ Object (also: #a)
- #disallow(pattern) ⇒ Object (also: #d)
- #ignored?(path) ⇒ Boolean (also: #disallow?)
-
#initialize ⇒ FileMonitorFilter
constructor
A new instance of FileMonitorFilter.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ FileMonitorFilter
Returns a new instance of FileMonitorFilter.
7 8 9 |
# File 'lib/file-monitor.rb', line 7 def initialize @patterns = [] end |
Instance Method Details
#allow(pattern) ⇒ Object Also known as: a
27 28 29 |
# File 'lib/file-monitor.rb', line 27 def allow(pattern) @patterns << [:allow, pattern] end |
#disallow(pattern) ⇒ Object Also known as: d
23 24 25 |
# File 'lib/file-monitor.rb', line 23 def disallow(pattern) @patterns << [:disallow, pattern] end |
#ignored?(path) ⇒ Boolean Also known as: disallow?
11 12 13 14 15 16 17 18 19 |
# File 'lib/file-monitor.rb', line 11 def ignored?(path) status = :allow for mode, pattern in @patterns if path =~ pattern status = mode end end return status == :disallow end |
#reset ⇒ Object
31 32 33 |
# File 'lib/file-monitor.rb', line 31 def reset @patterns = [] end |