Module: Net::IRC
- Included in:
- Client, Message, Server::Session
- Defined in:
- lib/net/irc.rb
Defined Under Namespace
Modules: Constants, PATTERN Classes: Client, IRCException, Message, Prefix, Server
Constant Summary collapse
- VERSION =
"0.0.9".freeze
- COMMANDS =
:nodoc:
Net::IRC::Constants.constants.inject({}) {|r, i| # :nodoc: r.update(Net::IRC::Constants.const_get(i).to_s => i.to_s.freeze) }
Class Method Summary collapse
-
.ctcp_decode(str) ⇒ Object
Decode from CTCP message delimited with x01.
- .ctcp_dequote(str) ⇒ Object
-
.ctcp_encode(str) ⇒ Object
Encode to CTCP message.
- .ctcp_quote(str) ⇒ Object
Class Method Details
.ctcp_decode(str) ⇒ Object
Decode from CTCP message delimited with x01.
49 50 51 |
# File 'lib/net/irc.rb', line 49 def ctcp_decode(str) ctcp_dequote(str.delete("\x01")) end |
.ctcp_dequote(str) ⇒ Object
60 61 62 |
# File 'lib/net/irc.rb', line 60 def ctcp_dequote(str) low_dequote(str).gsub("\\a", "\x01").gsub(/\\(.|\z)/m, "\\1") end |
.ctcp_encode(str) ⇒ Object
Encode to CTCP message. Prefix and postfix x01.
42 43 44 |
# File 'lib/net/irc.rb', line 42 def ctcp_encode(str) "\x01#{ctcp_quote(str)}\x01" end |
.ctcp_quote(str) ⇒ Object
55 56 57 |
# File 'lib/net/irc.rb', line 55 def ctcp_quote(str) low_quote(str.gsub("\\", "\\\\\\\\").gsub("\x01", "\\a")) end |