Class: Summer::Connection

Inherits:
Object show all
Includes:
Handlers
Defined in:
lib/summer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Handlers

#handle_422

Constructor Details

#initialize(server, port = 6667, dry = false) ⇒ Connection

Returns a new instance of Connection.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/summer.rb', line 14

def initialize(server, port=6667, dry=false)
  @ready = false
  @started = false

  @server = server
  @port = port

  load_config
  connect!

  unless dry
    loop do
      startup! if @ready && !@started
      message = @connection.gets
      if message
        parse(message)
      else
        break
      end
    end
  end
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



13
14
15
# File 'lib/summer.rb', line 13

def config
  @config
end

#connectionObject

Returns the value of attribute connection.



13
14
15
# File 'lib/summer.rb', line 13

def connection
  @connection
end

#portObject

Returns the value of attribute port.



13
14
15
# File 'lib/summer.rb', line 13

def port
  @port
end

#readyObject

Returns the value of attribute ready.



13
14
15
# File 'lib/summer.rb', line 13

def ready
  @ready
end

#serverObject

Returns the value of attribute server.



13
14
15
# File 'lib/summer.rb', line 13

def server
  @server
end

#startedObject

Returns the value of attribute started.



13
14
15
# File 'lib/summer.rb', line 13

def started
  @started
end