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.
93 94 95 |
# File 'lib/gamefic/engine.rb', line 93 def initialize(user) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
92 93 94 |
# File 'lib/gamefic/engine.rb', line 92 def user @user end |
Instance Method Details
#input ⇒ Object
96 97 98 99 100 101 |
# File 'lib/gamefic/engine.rb', line 96 def input line = @user.stream.recv if line != nil @user.character.queue.push line end end |
#output ⇒ Object
102 103 104 |
# File 'lib/gamefic/engine.rb', line 102 def output @user.stream.flush end |