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.
51 52 53 54 55 56 57 58 59 |
# File 'lib/active_scaffold/config/base.rb', line 51 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
61 62 63 |
# File 'lib/active_scaffold/config/base.rb', line 61 def [](key) @session[@action][key] if @action && @session[@action] end |
#[]=(key, value) ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/active_scaffold/config/base.rb', line 65 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 |