class Curator::Repository::Settings
Attributes
all[R]
changed[R]
to_hash[R]
Public Class Methods
new(current_settings = {})
click to toggle source
# File lib/curator/repository/settings.rb, line 10 def initialize(current_settings = {}) @all = HashWithIndifferentAccess.new(current_settings) clear_dirty! end
Public Instance Methods
[](property)
click to toggle source
# File lib/curator/repository/settings.rb, line 31 def [](property) all[property] end
apply!(opts = {})
click to toggle source
# File lib/curator/repository/settings.rb, line 43 def apply!(opts = {}) data_store = opts.fetch(:data_store) collection_name = opts.fetch(:collection_name) clear_dirty! if data_store.update_settings!(collection_name, changed) end
clear_dirty!()
click to toggle source
# File lib/curator/repository/settings.rb, line 39 def clear_dirty! @changed = HashWithIndifferentAccess.new end
disable(property)
click to toggle source
# File lib/curator/repository/settings.rb, line 27 def disable(property) set(property, false) end
enable(property)
click to toggle source
# File lib/curator/repository/settings.rb, line 23 def enable(property) set(property, true) end
set(property, value)
click to toggle source
# File lib/curator/repository/settings.rb, line 15 def set(property, value) original_value = all[property] unless value == original_value all[property] = value changed[property] = value end end
uncommitted?()
click to toggle source
# File lib/curator/repository/settings.rb, line 35 def uncommitted? changed.any? end