Class: Gamefic::UserState
- Inherits:
-
Object
- Object
- Gamefic::UserState
- Defined in:
- lib/gamefic/engine.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user) ⇒ UserState
constructor
A new instance of UserState.
- #input ⇒ Object
- #output ⇒ Object
Constructor Details
#initialize(user) ⇒ UserState
Returns a new instance of UserState.
94 95 96 |
# File 'lib/gamefic/engine.rb', line 94 def initialize(user) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
93 94 95 |
# File 'lib/gamefic/engine.rb', line 93 def user @user end |
Instance Method Details
#input ⇒ Object
97 98 99 100 101 102 |
# File 'lib/gamefic/engine.rb', line 97 def input line = @user.stream.recv if line != nil @user.character.queue.push line end end |
#output ⇒ Object
103 104 105 |
# File 'lib/gamefic/engine.rb', line 103 def output @user.stream.flush end |