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.



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

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.



223
224
225
# File 'lib/build/files/state.rb', line 223

def monitor
  @monitor
end

Instance Method Details

#changed!Object



237
238
239
# File 'lib/build/files/state.rb', line 237

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

#commit!Object



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

def commit!
	@state.update!
end

#directoriesObject



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

def directories
	@state.files.roots
end

#remove!Object



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

def remove!
	monitor.delete(self)
end