class Relayer::IRC::User

Constants

IRC_HOSTMASK_REGEX

Attributes

hostmask[RW]
hostname[RW]
ident[RW]
nick[RW]

Public Class Methods

is_user?(hostmask) click to toggle source
# File lib/relayer/irc/user.rb, line 7
def self.is_user?(hostmask)
  not IRC_HOSTMASK_REGEX.match(hostmask).nil?
end
new(hostmask) click to toggle source
# File lib/relayer/irc/user.rb, line 31
def initialize(hostmask)
  @hostmask = hostmask
  parse_hostmask!
end
parse_hostmask(hostmask) click to toggle source
# File lib/relayer/irc/user.rb, line 15
def self.parse_hostmask(hostmask)
  match = IRC_HOSTMASK_REGEX.match hostmask
  return if match.nil?
  
  raw, nick, ident_tmp, ident, hostname_tmp, hostname = match.to_a
  return :nick => nick, :ident => ident, :hostname => hostname
end

Public Instance Methods

parse_hostmask!() click to toggle source
# File lib/relayer/irc/user.rb, line 23
def parse_hostmask!
  parts = User.parse_hostmask @hostmask
  
  @nick = parts[:nick]
  @ident = parts[:ident]
  @hostname = parts[:hostname]
end
to_s() click to toggle source
# File lib/relayer/irc/user.rb, line 11
def to_s
  @nick
end