Class: ActiveScaffold::Config::Base::UserSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/active_scaffold/config/base.rb

Instance Method Summary (collapse)

Constructor Details

- (UserSettings) initialize(conf, storage, params, action = :base)

Returns a new instance of UserSettings



46
47
48
49
50
51
52
53
54
# File 'lib/active_scaffold/config/base.rb', line 46

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
end

Instance Method Details

- (Object) [](key)



56
57
58
# File 'lib/active_scaffold/config/base.rb', line 56

def [](key)
  @session[@action][key] if @action && @session[@action]
end

- (Object) []=(key, value)



60
61
62
63
64
65
66
67
68
# File 'lib/active_scaffold/config/base.rb', line 60

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