Class: Build::Files::Handle

Inherits:
Object
  • Object
show all
Defined in:
lib/build/files/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(monitor, files, &block) ⇒ Handle

Returns a new instance of Handle.



213
214
215
216
217
# File 'lib/build/files/state.rb', line 213

def initialize(monitor, files, &block)
	@monitor = monitor
	@state = State.new(files)
	@on_changed = block
end

Instance Attribute Details

#monitorObject (readonly)

Returns the value of attribute monitor.



219
220
221
# File 'lib/build/files/state.rb', line 219

def monitor
  @monitor
end

Instance Method Details

#changed!Object



233
234
235
# File 'lib/build/files/state.rb', line 233

def changed!
	@on_changed.call(@state) if @state.update!
end

#commit!Object



221
222
223
# File 'lib/build/files/state.rb', line 221

def commit!
	@state.update!
end

#directoriesObject



225
226
227
# File 'lib/build/files/state.rb', line 225

def directories
	@state.files.roots
end

#remove!Object



229
230
231
# File 'lib/build/files/state.rb', line 229

def remove!
	monitor.delete(self)
end