Class: Cinch::Ban
- Inherits:
-
Object
- Object
- Cinch::Ban
- Defined in:
- lib/cinch/ban.rb
Overview
This class represents channel bans.
Instance Attribute Summary collapse
-
#by ⇒ User?
readonly
The user who created the ban.
- #created_at ⇒ Time readonly
-
#extended ⇒ Boolean
readonly
Whether this is an extended ban (as used by for example Freenode).
- #mask ⇒ Mask, String readonly
Instance Method Summary collapse
-
#initialize(mask, by, at) ⇒ Ban
constructor
A new instance of Ban.
-
#match(user) ⇒ Boolean
(also: #=~)
True if the ban matches ‘user`.
- #to_s ⇒ String
Constructor Details
Instance Attribute Details
#by ⇒ User? (readonly)
The user who created the ban. Might be nil on networks that do not strictly follow the RFCs, for example IRCnet in some(?) cases.
17 18 19 |
# File 'lib/cinch/ban.rb', line 17 def by @by end |
#created_at ⇒ Time (readonly)
20 21 22 |
# File 'lib/cinch/ban.rb', line 20 def created_at @created_at end |
#extended ⇒ Boolean (readonly)
Returns whether this is an extended ban (as used by for example Freenode).
23 24 25 |
# File 'lib/cinch/ban.rb', line 23 def extended @extended end |
Instance Method Details
#match(user) ⇒ Boolean Also known as: =~
Returns true if the ban matches ‘user`.
42 43 44 45 |
# File 'lib/cinch/ban.rb', line 42 def match(user) raise UnsupportedFeature, "extended bans are not supported yet" if @extended @mask =~ user end |