Class: ItunesController::ServerState

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

Overview

Used to store the state within the server of each connected client

Constant Summary collapse

NOT_AUTHED =
1
DOING_AUTH =
2
AUTHED =
3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ServerState

Returns a new instance of ServerState.



78
79
80
81
82
# File 'lib/itunesController/controllserver.rb', line 78

def initialize(config)
    @state=ServerState::NOT_AUTHED
    @files=[]
    @config=config           
end

Instance Attribute Details

#configItunesController::ServerConfig

The server configuration

Returns:



70
71
72
# File 'lib/itunesController/controllserver.rb', line 70

def config
  @config
end

#filesArray[String]

An array that contains the list of registered files the client is working on

Returns:

  • (Array[String])

    the current value of files



70
71
72
# File 'lib/itunesController/controllserver.rb', line 70

def files
  @files
end

#stateNumber

The server state. Either ServerState::NOT_AUTHED, ServerState::DOING_AUTHED or ServerState::AUTHED

Returns:

  • (Number)

    the current value of state



70
71
72
# File 'lib/itunesController/controllserver.rb', line 70

def state
  @state
end

#userString

The logged in user

Returns:

  • (String)

    the current value of user



70
71
72
# File 'lib/itunesController/controllserver.rb', line 70

def user
  @user
end

Instance Method Details

#cleanObject



84
85
86
87
# File 'lib/itunesController/controllserver.rb', line 84

def clean
    @state=ServerState::NOT_AUTHED
    @files=[]
end