Module: IIRC
- Defined in:
- lib/iirc.rb,
lib/iirc/bot.rb,
lib/iirc/user.rb,
lib/iirc/event.rb,
lib/iirc/sender.rb,
lib/iirc/version.rb,
lib/iirc/numerics.rb,
lib/iirc/modules/pong.rb,
lib/iirc/modules/hooks.rb,
lib/iirc/modules/redis.rb,
lib/iirc/modules/verbs.rb,
lib/iirc/modules/ambient.rb,
lib/iirc/modules/members.rb,
lib/iirc/modules/oper_up.rb,
lib/iirc/modules/parsing.rb,
lib/iirc/modules/reading.rb,
lib/iirc/modules/autojoin.rb,
lib/iirc/modules/channels.rb,
lib/iirc/modules/isupport.rb,
lib/iirc/modules/print_io.rb,
lib/iirc/modules/configure.rb,
lib/iirc/modules/formatting.rb,
lib/iirc/modules/ircv3/caps.rb,
lib/iirc/modules/regex_hooks.rb,
lib/iirc/modules/reply_target.rb,
lib/iirc/modules/ircv3/batches.rb,
lib/iirc/modules/ircv3/parsing.rb,
lib/iirc/modules/accept_invites.rb,
lib/iirc/modules/track_own_nick.rb,
lib/iirc/modules/ircv3/labeled_requests.rb
Defined Under Namespace
Modules: AcceptInvites, Ambient, AutoJoin, Batteries, Channels, Configure, Formatting, Hooks, IRCv3, ISupport, Members, Numerics, OperUp, Parsing, Pong, PrintIO, Reading, Redis, RegexHooks, ReplyTarget, SSL, Sender, TrackOwnNick, Verbs Classes: Bot, Error, Event, IRCv3Bot, User
Constant Summary collapse
- VERSION =
"0.6.3"
Class Method Summary collapse
- .dial(host, port = 6697, local_host: nil, local_port: nil, ssl_context: SSL.default_context) ⇒ Object
-
.Sender(source) ⇒ Object
Adds the IIRC::Sender mixin to a string.
Instance Method Summary collapse
- #dial(host, port = 6697, local_host: nil, local_port: nil, ssl_context: SSL.default_context) ⇒ Object private
-
#Sender(source) ⇒ Object
private
Adds the IIRC::Sender mixin to a string.
Class Method Details
.dial(host, port = 6697, local_host: nil, local_port: nil, ssl_context: SSL.default_context) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/iirc.rb', line 112 def dial(host, port=6697, local_host: nil, local_port: nil, ssl_context: SSL.default_context) require 'socket' Socket.tcp(host, port, local_host, local_port).then { |socket| if ssl_context ssl_context = SSL.send(ssl_context) if ssl_context.is_a? Symbol OpenSSL::SSL::SSLSocket.new(socket, ssl_context).tap { |socket| socket.hostname = host socket.connect } else socket end } end |
.Sender(source) ⇒ Object
Adds the IIRC::Sender mixin to a string. If the string is frozen, a copy is returned. If the source is nil, nil is returned.
63 64 65 66 67 68 69 |
# File 'lib/iirc/sender.rb', line 63 def Sender(source) if source.nil? nil else (source.frozen? ? source.dup : source).extend(Sender) end end |
Instance Method Details
#dial(host, port = 6697, local_host: nil, local_port: nil, ssl_context: SSL.default_context) ⇒ Object (private)
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/iirc.rb', line 112 def dial(host, port=6697, local_host: nil, local_port: nil, ssl_context: SSL.default_context) require 'socket' Socket.tcp(host, port, local_host, local_port).then { |socket| if ssl_context ssl_context = SSL.send(ssl_context) if ssl_context.is_a? Symbol OpenSSL::SSL::SSLSocket.new(socket, ssl_context).tap { |socket| socket.hostname = host socket.connect } else socket end } end |
#Sender(source) ⇒ Object (private)
Adds the IIRC::Sender mixin to a string. If the string is frozen, a copy is returned. If the source is nil, nil is returned.
63 64 65 66 67 68 69 |
# File 'lib/iirc/sender.rb', line 63 def Sender(source) if source.nil? nil else (source.frozen? ? source.dup : source).extend(Sender) end end |