module Settings::ClassLevel::ClassMethods
Public Instance Methods
class_settings_reset!()
click to toggle source
Reset state to default values only - useful in testing
# File lib/iron/settings/class_level.rb, line 30 def class_settings_reset! @settings_values = @settings_class_options[:store] == :static ? Settings::StaticStore.new(@settings_class_root, @settings_class_options) : Settings::DbStore.new(@settings_class_root, @settings_class_options) end
reload_settings()
click to toggle source
Force a settings reload (from db or file(s) depending on settings) regardless of need to reload automatically. Useful for testing, but not generally needed in production use
# File lib/iron/settings/class_level.rb, line 38 def reload_settings @settings_values.load true end
settings(&block)
click to toggle source
Access the class-level settings values for this class, returns a Settings::Cursor
to read/write, pointed at the root of the settings definition for this class.
Optionally accepts a block for mass assignment using DSL setters, eg:
Foo.settings do some_group.some_entry 'some value' some_other_entry 250 end
# File lib/iron/settings/class_level.rb, line 22 def settings(&block) @settings_values.reload_if_needed cursor = Settings::Cursor.new(@settings_class_root, @settings_values) DslProxy::exec(cursor, &block) if block cursor end