Class: AlController::AlControllerSession

Inherits:
Object
  • Object
show all
Defined in:
lib/al_controller.rb

Overview

コントローラローカルのセッション変数の動作定義

Instance Method Summary (collapse)

Instance Method Details

- (Object) [](k)

変数の取得

Parameters:

  • (Symbol) k

    キー

Returns:

  • (Object)



44
45
46
# File 'lib/al_controller.rb', line 44

def []( k )
  return AlSession["AL_#{AlController::CTRL}_#{k}"]
end

- (Object) []=(k, v)

変数の保存

Parameters:

  • (Symbol) k

    キー

  • (Object) v



34
35
36
# File 'lib/al_controller.rb', line 34

def []=( k, v )
  AlSession["AL_#{AlController::CTRL}_#{k}"] = v
end

- (Object) delete(k)

変数の消去

Parameters:

  • (Symbol) k

    キー



53
54
55
# File 'lib/al_controller.rb', line 53

def delete( k )
  AlSession::delete( "AL_#{AlController::CTRL}_#{k}" )
end

- (Object) delete_all

変数の全消去



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

def delete_all()
  AlSession::delete( "AL_STATE_#{CTRL}" )
  prefix = "AL_#{AlController::CTRL}_"
  AlSession::keys().each do |k|
    if k.to_s.index( prefix ) == 0
      AlSession::delete( k )
    end
  end
end