Class: Bini::Sash
- Inherits:
-
Hash
- Object
- Hash
- Bini::Sash
- Includes:
- Extensions::Savable
- Defined in:
- lib/bini/sash.rb
Overview
This is a savable hash, it can be configured and used to store whatever the# contents of the hash are for loading later. Will serialize in yaml to keep all the dependencies in ruby stdlib.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Sash
constructor
overrides:Hash.new options: Sash options.
Methods included from Extensions::Savable
#[]=, #backup, #backup_file, #basedir, #clean_files, #is_dirty?, #load, #options, #save, #set_mode
Constructor Details
#initialize(params = {}) ⇒ Sash
overrides:Hash.new options: Sash options.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bini/sash.rb', line 12 def initialize(params = {}) # if we get any params not listed above, throw an exception. p = params.select { |k,v| k != :options && k != :overrides} raise ArgumentError, "Extra values passed in: #{p}" if p.count > 0 # set our options to our attributes. .merge! params[:options] if params[:options] load if self.[:autoload] self.merge! params[:overrides] if params[:overrides] return self end |