class Cinch::Ban
This class represents channel bans.
Attributes
by[R]
The user who created the ban. Might be nil on networks that do not strictly follow the RFCs, for example IRCnet in some(?) cases.
@return [User, nil] The user who created the ban
created_at[R]
@return [Time]
extended[R]
@return [Boolean] whether this is an extended ban (as used by for example Freenode)
mask[R]
@return [Mask] A {Mask} object for non-extended bans @return [String] A String
object for extended bans (see {#extended})
Public Class Methods
new(mask, by, at)
click to toggle source
@param [String, Mask] mask The mask @param [User, nil] by The user who created the ban. @param [Time] at The time at which the ban was created
# File lib/cinch/ban.rb, line 25 def initialize(mask, by, at) @by, @created_at = by, at if mask =~ /^[\$~]/ @extended = true @mask = mask else @extended = false @mask = Mask.from(mask) end end
Public Instance Methods
match(user)
click to toggle source
@return [Boolean] true if the ban matches `user` @raise [Exceptions::UnsupportedFeature] Cinch
does not support
Freenode's extended bans
# File lib/cinch/ban.rb, line 39 def match(user) raise UnsupportedFeature, "extended bans are not supported yet" if @extended @mask =~ user end
Also aliased as: =~
to_s()
click to toggle source
@return [String]
# File lib/cinch/ban.rb, line 46 def to_s @mask.to_s end