class Gluer::File
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/gluer/file.rb, line 8 def initialize(path) @path = path end
Public Instance Methods
add_registration(registration)
click to toggle source
# File lib/gluer/file.rb, line 20 def add_registration(registration) new_registration_pool.add(registration) touch end
reload()
click to toggle source
# File lib/gluer/file.rb, line 30 def reload load_from_source if touched? registration_pool.rollback new_registration_pool.commit registration_pool.replace(new_registration_pool) new_registration_pool.clear end end
touch()
click to toggle source
# File lib/gluer/file.rb, line 12 def touch @touched = true end
touched?()
click to toggle source
# File lib/gluer/file.rb, line 16 def touched? !!@touched end
unload()
click to toggle source
# File lib/gluer/file.rb, line 25 def unload registration_pool.rollback registration_pool.clear end
Private Instance Methods
load_from_source()
click to toggle source
# File lib/gluer/file.rb, line 50 def load_from_source @touched = false Gluer.config.file_loader.call(path) end
new_registration_pool()
click to toggle source
# File lib/gluer/file.rb, line 46 def new_registration_pool @new_registration_pool ||= RegistrationPool.new end
registration_pool()
click to toggle source
# File lib/gluer/file.rb, line 42 def registration_pool @registration_pool ||= RegistrationPool.new end