Class: ActiveScaffold::Config::Base::UserSettings
- Defined in:
- lib/active_scaffold/config/base.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(conf, storage, params, action = :base) ⇒ UserSettings
constructor
A new instance of UserSettings.
Constructor Details
#initialize(conf, storage, params, action = :base) ⇒ UserSettings
Returns a new instance of UserSettings.
49 50 51 52 53 54 55 56 57 |
# File 'lib/active_scaffold/config/base.rb', line 49 def initialize(conf, storage, params, action = :base) # the session hash relevant to this action @session = storage # all the request params @params = params # the configuration object for this action @conf = conf @action = action.to_s end |
Instance Method Details
#[](key) ⇒ Object
59 60 61 |
# File 'lib/active_scaffold/config/base.rb', line 59 def [](key) @session[@action][key] if @action && @session[@action] end |
#[]=(key, value) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/active_scaffold/config/base.rb', line 63 def []=(key, value) @session[@action] ||= {} if value @session[@action][key] = value else @session[@action].delete key @session.delete @action if @session[@action].empty? end end |