Class: Uppercut::Base
- Inherits:
-
Object
- Object
- Uppercut::Base
- Defined in:
- lib/uppercut/base.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#roster ⇒ Object
readonly
Returns the value of attribute roster.
Instance Method Summary collapse
-
#connect ⇒ Object
Attempt to connect to the server, if not already connected.
-
#connected? ⇒ Boolean
True if the Agent is currently connected to the Jabber server.
-
#disconnect ⇒ Object
Disconnects from the server if it is connected.
-
#reconnect ⇒ Object
Disconnects and connects to the server.
-
#stanza(msg) ⇒ Object
:nodoc:.
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
30 31 32 |
# File 'lib/uppercut/base.rb', line 30 def client @client end |
#roster ⇒ Object (readonly)
Returns the value of attribute roster.
30 31 32 |
# File 'lib/uppercut/base.rb', line 30 def roster @roster end |
Instance Method Details
#connect ⇒ Object
Attempt to connect to the server, if not already connected.
Raises a simple RuntimeError if it fails to connect. This should be changed eventually to be more useful.
12 13 14 15 16 17 |
# File 'lib/uppercut/base.rb', line 12 def connect return if connected? connect! raise 'Failed to connected' unless connected? present! end |
#connected? ⇒ Boolean
True if the Agent is currently connected to the Jabber server.
33 34 35 |
# File 'lib/uppercut/base.rb', line 33 def connected? @client.respond_to?(:is_connected?) && @client.is_connected? end |
#disconnect ⇒ Object
Disconnects from the server if it is connected.
20 21 22 |
# File 'lib/uppercut/base.rb', line 20 def disconnect disconnect! if connected? end |
#reconnect ⇒ Object
Disconnects and connects to the server.
25 26 27 28 |
# File 'lib/uppercut/base.rb', line 25 def reconnect disconnect connect end |
#stanza(msg) ⇒ Object
:nodoc:
3 4 5 6 |
# File 'lib/uppercut/base.rb', line 3 def stanza(msg) #:nodoc: return false unless connected? send! msg end |