class Consent::Reloader
Rails file reloader to detect permission changes and apply them to consent
Attributes
paths[R]
Public Class Methods
new(default_path, mechanism)
click to toggle source
# File lib/consent/reloader.rb, line 9 def initialize(default_path, mechanism) @paths = [default_path] @mechanism = mechanism end
Private Instance Methods
globs()
click to toggle source
# File lib/consent/reloader.rb, line 25 def globs pairs = paths.map { |path| [path.to_s, %w[rb]] } Hash[pairs] end
reload!()
click to toggle source
# File lib/consent/reloader.rb, line 16 def reload! Consent.subjects.clear Consent.load_subjects! paths, @mechanism end
updater()
click to toggle source
# File lib/consent/reloader.rb, line 21 def updater @updater ||= ActiveSupport::FileUpdateChecker.new([], globs) { reload! } end