Sha256: 9d33c99416e387a482f26fe17f40d4ca832294a880cc1a41575df285fc8f7736
Contents?: true
Size: 711 Bytes
Versions: 2
Compression:
Stored size: 711 Bytes
Contents
module ActsAsPreferenced # This class only helps with defining of preference sections, not with storage # (as I see no reason to make storage more complicated while bringing no real # benefit) class Section # Options: # * prefix - if true, section name will be prepended to all preferences # defined within. False by default def initialize( store, name, options = {} ) options.assert_valid_keys( :prefix ) @store, @name = store, name @prefix = options[:prefix] end def preference( name, options = {} ) pref_name = (@prefix ? "#{@name}_#{name}".to_sym : name) @store.preference( pref_name, options.merge( :section => @name )) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acts_as_preferenced-0.9.1 | lib/acts_as_preferenced/section.rb |
acts_as_preferenced-0.9.0 | lib/acts_as_preferenced/section.rb |