Class: Build::Files::Monitor::Handle
- Inherits:
-
Object
- Object
- Build::Files::Monitor::Handle
- Defined in:
- lib/build/files/monitor/handle.rb
Instance Attribute Summary collapse
-
#monitor ⇒ Object
readonly
Returns the value of attribute monitor.
Instance Method Summary collapse
-
#changed! ⇒ Object
Inform the handle that it might have been modified.
- #commit! ⇒ Object
- #directories ⇒ Object
-
#initialize(monitor, files, &block) ⇒ Handle
constructor
A new instance of Handle.
- #remove! ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(monitor, files, &block) ⇒ Handle
Returns a new instance of Handle.
12 13 14 15 16 |
# File 'lib/build/files/monitor/handle.rb', line 12 def initialize(monitor, files, &block) @monitor = monitor @state = State.new(files) @block = block end |
Instance Attribute Details
#monitor ⇒ Object (readonly)
Returns the value of attribute monitor.
18 19 20 |
# File 'lib/build/files/monitor/handle.rb', line 18 def monitor @monitor end |
Instance Method Details
#changed! ⇒ Object
Inform the handle that it might have been modified.
33 34 35 36 37 38 |
# File 'lib/build/files/monitor/handle.rb', line 33 def changed! # If @state.update! did not find any changes, don't invoke the callback: if @state.update! @block.call(@state) end end |
#commit! ⇒ Object
20 21 22 |
# File 'lib/build/files/monitor/handle.rb', line 20 def commit! @state.update! end |
#directories ⇒ Object
24 25 26 |
# File 'lib/build/files/monitor/handle.rb', line 24 def directories @state.files.roots end |
#remove! ⇒ Object
28 29 30 |
# File 'lib/build/files/monitor/handle.rb', line 28 def remove! @monitor.delete(self) end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/build/files/monitor/handle.rb', line 40 def to_s "\#<#{self.class} @state=#{@state} @block=#{@block}>" end |